Is there any logn solution worst case?

  • 0

    Most of the solution described are O(N) worst case. I am trying log(N) but never able to pass all the test cases.

  • 2

    That's not possible.

    The worst case is I have something like [1, 1, 1, 0, 1, 1, ..., 1, 1] - the minimum number only appears once, and all other elements are the same. In this way, without testing all numbers, it is not possible to find the minimum one.

Log in to reply

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