A question about the time complexity


  • 1
    E

    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?


  • 0
    S

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


  • 0
    E

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


Log in to reply
 

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