Given a list nums, a non-negative integer k and a value fill, return a new list of the same length in which every element has moved k positions to the left. The first k elements are dropped (they do not wrap around) and the k vacated positions at the end are filled with fill. If k is at least the length of the list, the result consists entirely of fill.
Examples
Input: nums = [1, 2, 3, 4, 5], k = 2, fill = 0
Output: [3, 4, 5, 0, 0]
Input: nums = [1, 2], k = 5, fill = -1
Output: [-1, -1]
Constraints
0 <= len(nums) <= 10**50 <= k <= 10**9- Return a new list; do not modify
nums. - Target: O(n) time.
Goals
- Distinguish a shift from a rotation
- Keep the output length equal to the input length
- Clamp a shift larger than the list