Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

Many people give the solution of O(lg(n)) time complexity. But all these solutions are based on some certain data structure such as binary tree. Build such a tree will cost another O(nlg(n)) time. So why not directly find the max of the array?

The logN solution doesn't need any data structure. Check out a sharing post here.

Great solution!!!!! That remind me of some method in calculus! Thank you very much!

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.