Hi ALL , Anyone can let me know there's a pre-condition that saying the maximun of A[i] < A.length


  • 1
    L

    I read a lot of the answers they all get O(n) solution that base on a pre condition , then the bucket sort can be applied, So anyone can tell me where can get this from the question statement ? I can't fingure out where I missed.


  • -1
    C

    No you don't need that condition.
    Because let's say A[m] > n, we lose nothing by not checking it, why? because the least-missing-positive is always less than n.


Log in to reply
 

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