I don't see why the answer to
nums = , 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.