Says it all.
Quote: "You may assume k is always valid, ie: 1 ≤ k ≤ input array's size for non-empty array."
The test case where k is zero doesn't have a non-empty array. So it's fine.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.