ft

weui hd bd ft

匿名 (未验证) 提交于 2019-12-03 00:37:01
weui样式看到hd ,bd, ft hd 是header的缩写 bd 是body的缩写 ft 是footer的缩写 weui hd bd ft 原文:https://www.cnblogs.com/zhaogaojian/p/9229707.html

142. Linked List Cycle II(链表)

匿名 (未验证) 提交于 2019-12-03 00:19:01
https://leetcode.com/problems/linked-list-cycle-ii/description/ 题目:如果链表有环,返回环的入口,负责返回NULL. 思路:快慢指针,考虑下面的链表环,其中4->2表示4的下一元素为2。 1 -> 2 -> 3 -> 4 -> 2 。 ft st flag 1 1 0 3 2 0 2 3 0 4 4 1 当flag为 1 时, ft 与st指向同一元素: 4 其中 ft 遍历的路径为: 1 -> 2 -> 3 -> 4 -> 2 -> 3 -> 4 ,路径长度为 6 st 遍历的路径为: 1 -> 2 -> 3 -> 4 路径长度为 3 ft 的路径长度刚好为st的两倍,st回到head,继续 ft st flag 4 1 1 2 2 1 其中 ft 遍历的路径为: 4 -> 2 , 路径长度为 1 st 遍历的路径为: 1 -> 2 路径长度为 1 路径长度相等,再次相遇即为入口地址。 class Solution { public : ListNode * detectCycle(ListNode * head) { ListNode * ft = head, * st = head; bool flag = 0 ; while ( ft && ft -> next){ st = st -> next; ft =

142. Linked List Cycle II(链表)

匿名 (未验证) 提交于 2019-12-03 00:18:01
https://leetcode.com/problems/linked-list-cycle-ii/description/ 题目:如果链表有环,返回环的入口,负责返回NULL. 思路:快慢指针,考虑下面的链表环,其中4->2表示4的下一元素为2。 1 -> 2 -> 3 -> 4 -> 2 。 ft st flag 1 1 0 3 2 0 2 3 0 4 4 1 当flag为 1 时, ft 与st指向同一元素: 4 其中 ft 遍历的路径为: 1 -> 2 -> 3 -> 4 -> 2 -> 3 -> 4 ,路径长度为 6 st 遍历的路径为: 1 -> 2 -> 3 -> 4 路径长度为 3 ft 的路径长度刚好为st的两倍,st回到head,继续 ft st flag 4 1 1 2 2 1 其中 ft 遍历的路径为: 4 -> 2 , 路径长度为 1 st 遍历的路径为: 1 -> 2 路径长度为 1 路径长度相等,再次相遇即为入口地址。 class Solution { public : ListNode * detectCycle(ListNode * head) { ListNode * ft = head, * st = head; bool flag = 0 ; while ( ft && ft -> next){ st = st -> next; ft =