141.Linked List Cycle
生活随笔
收集整理的這篇文章主要介紹了
141.Linked List Cycle
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
class Solution {
public:bool hasCycle(ListNode *head) {ListNode *slow = head, *fast = head;while (fast && fast->next) {slow = slow->next;fast = fast->next->next;if (slow == fast) return true;}return false;}
};
轉(zhuǎn)載于:https://www.cnblogs.com/smallredness/p/10681759.html
總結(jié)
以上是生活随笔為你收集整理的141.Linked List Cycle的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: echarts粗解
- 下一篇: hdu1284经典钱币兑换问题