Doesn't empty array count as a sub-array?

  • 1

    I don't see why the answer to nums = [1], k = 0 should be 0

    The problem statement does not say that we only consider non-empty sub-array.
    According to this Stanford lecture
    A subarray of an array is a consecutive sequence of zero or more values taken out of that array.

    So empty array does count as a sub-array.

Log in to reply

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