题目:

题解:
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if k == 0 or not head or not head.next:
return head
n = 1
cur = head
while cur.next:
cur = cur.next
n += 1
if (add := n - k % n) == n:
return head
cur.next = head
while add:
cur = cur.next
add -= 1
ret = cur.next
cur.next = None
return ret

















![[Unity常见小问题]打包ios后无法修改模型透明度](https://img-blog.csdnimg.cn/direct/99a63fd3c84040c5ba841a02c2714f30.png)

