murlikrishna.b
BAN USERCorrect its just sorting n^2 elements you can use merge sort with complexity ( n^2 Log n^2) which is 2*n^2Logn
- murlikrishna.b September 15, 2014The solution is very simple assuming everyone is using an extra space scan the input array maintain 2 points left and right. Insert into the left index and increment if you find the element is less than the pivot and insert into the right index and decrement the right index.
- murlikrishna.b July 02, 2013bow..
- murlikrishna.b July 01, 2013not necessarily as getsomeStuff() may return null as well.
- murlikrishna.b July 01, 2013t1->left.Data==t2->left.Data
and else if(t1->left.Data==t2->right.Data)
clear and precise but lot of extra memory will be used. call stack though you are not using explicitly but your program do, but liked the solution had a similar approach but explicitly using stack.
- murlikrishna.b July 01, 2013reminding me abacus...
- murlikrishna.b July 01, 2013Why can't we start finding from the middle and widen the string if pallindrome else shift the center element or vertex. We are interested in max Pallindrom so we can always decide if we really need to look further for a pallindrome or not if we use this approach.
- murlikrishna.b June 20, 2013Brute force way.. no use of past result why do you have to proceed to the right if you already have a max pallindrome which is greater than the twice of the number of elements to the right of the center vertex.
n square times if the whole string is pallindrome and other optimization possible.
if(sum < coins[i]) continue; is not required.
- murlikrishna.b June 19, 2013
K = Diff(i,j) should be the difference not Max consider i = 19 and j = 20
- murlikrishna.b June 15, 2019