class Solution(object): def repeatedNTimes(self, head, n): left = right = head for i in range(n): right = right.next if right is None: return head.next # special while right.next is not None: right = right.next left = left.next left.next = left.next.next return head
19. Remove Nth Node From End of List——linklist
最新推荐文章于 2021-09-18 21:49:11 发布