题解 | #旋转数组#
旋转数组
https://www.nowcoder.com/practice/e19927a8fd5d477794dac67096862042
class Solution: def solve(self , n: int, m: int, a: List[int]) -> List[int]: n = n-m%n return a[n:]+a[:n]
旋转数组
https://www.nowcoder.com/practice/e19927a8fd5d477794dac67096862042
class Solution: def solve(self , n: int, m: int, a: List[int]) -> List[int]: n = n-m%n return a[n:]+a[:n]
相关推荐