Carousel rotation

Write codeEasy12 min

Your task

A storefront carousel shows product IDs in order. Every night it advances k positions: the first k products move to the back and everything else slides toward the front. Given the current ID list and a non-negative k (which may be larger than the list length), return the carousel after one night. Example: [1, 2, 3, 4, 5] with k = 2 becomes [3, 4, 5, 1, 2].

Examples

advance_carousel(ids: list[int], k: int) -> list[int]
Example 1
Inputadvance_carousel([1, 2, 3, 4, 5], 2)
Output[3, 4, 5, 1, 2]