@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
M
mittalrishabh
@mittalrishabh
3
Reputation
7
Posts
203
Profile views
0
Followers
0
Following
Posts made by mittalrishabh

RE: Possibly simplest solution with O(n) time complexity

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)