I am solving this spoj.com/problems/ABA12B/ problem in O(n3)...can anyone plz give me the code or a dp recurssive solution in o(n2) time...
I don't think O(n^2) will be fast enough.
so can we do that in less than o(n2)...i tried dp...but not working...can u suggest something