Do we need to add test cases where n-1 is unreachable from 0?


  • 1
    Z

    Since the array may contain 0, it is possible that n -1 is unreachable from 0, e.g.,
    A[] = {0, 1, 2, 3} or {1, 0, 2, 3}.

    If the array only contains positive integers, there always exists a minimum number of steps which is not greater than n - 1 since each step we can advance at least 1 index.


Log in to reply
 

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