摘要:
Rotate List 旋转链表 Given the head of a linked list, rotate the list to the right by k places. Input: head = [1,2,3,4,5], k = 2 Output: [4,5,1,2,3] 向右旋转 阅读全文
posted @ 2021-03-10 11:33
WilliamCui
阅读(89)
评论(0)
推荐(0)
摘要:
Reverse Linked List II 反转链表 Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list 阅读全文
posted @ 2021-03-10 00:18
WilliamCui
阅读(92)
评论(0)
推荐(0)
摘要:
Happy Number 快乐数 Write an algorithm to determine if a number n is happy. 判断一个数是否是快乐数 Input: n = 19 Output: true Explanation: 1^2 + 9^2 = 82 8^2 + 2^2 阅读全文
posted @ 2021-03-10 00:07
WilliamCui
阅读(299)
评论(0)
推荐(0)
摘要:
Linked List Cycle find cycle begins 环形链表II [返回环的入口节点] 双指针 快慢指针,快指针一次移动2个node,慢指针一次移动1个node, 通过公式推导的结论,当快慢指针在环内相遇到的节点开始继续使用指针依次遍历到环的入口的步数等于从头结点使用指针依次遍历 阅读全文
posted @ 2021-03-10 00:04
WilliamCui
阅读(55)
评论(0)
推荐(0)


浙公网安备 33010602011771号