@ckcz123 this solution is wrong. Try giving input "abcdcgha". It maximum palindrome is 3 but your algorithm gives 5.
M
mittalrishabh
@mittalrishabh
0
Reputation
6
Posts
34
Profile views
0
Followers
0
Following
Posts made by mittalrishabh

RE: Straight forward Java DP solution

RE: Possibly simplest solution with O(n) time complexity
@mzchen It is not similar to find the max sum in an array. In max sum we can discard the previous sum as soon as it is zero. In multipication , we can not do it as product of two negative numbers become positive numbers

RE: O(n)+O(1) after median  Virtual Indexing
@selim heap is always constructed from bottom up in an array.

RE: O(n)+O(1) after median  Virtual Indexing
Geting elements in sorted order from heap is O(n)(logn). Building heap is O(n).
http://stackoverflow.com/questions/9755721/howcanbuildingaheapbeontimecomplexity

RE: O(n)+O(1) after median  Virtual Indexing
Why can't we change it to heap sort and then do inorder traversal. It would have complexity of O(n)

RE: Plane Sweep To Solve a hard Google Onsite Problem @08/10
Every rectangle would have two intervals (y1,y2) on y axis and (x1, x2) on x axis. We need to sort all the y coordinates first based on this intervals and then x coordinates based on this interval.