Linked List Cycle
来源:互联网 发布:西部网络达人秀开场舞 编辑:程序博客网 时间:2024/06/05 15:46
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bool hasCycle(ListNode *head) { if(head==NULL) return false; ListNode *slow=head; ListNode *fast=head->next; while(fast&&fast->next) { slow=slow->next; fast=fast->next->next; if(slow==fast) return true; } return false; }};
0 0
- leetcode Linked List Cycle & Linked List Cycle ||
- Linked List Cycle II Linked List Cycle
- 【LeetCode】Linked List Cycle
- Leetcode: Linked List Cycle
- Leetcode Linked List Cycle
- Linked List Cycle
- Linked List Cycle II
- Linked List Cycle
- Linked List Cycle
- Linked List Cycle II
- Leetcode: Linked List Cycle
- LeetCode:Linked List Cycle
- Linked List Cycle II
- Linked List Cycle
- Linked List Cycle II
- [LeetCode]Linked List Cycle
- Linked List Cycle
- LeetCode | Linked List Cycle
- Java查漏补缺系列——关于保留位数,四舍五入的方法
- 字符串匹配(java)实现,普通的匹配和KMP算法 (参考)
- 高效程序员的45个习惯之敏捷反馈
- leveldb之cache
- Struts2.3.14分析-初始化1
- Linked List Cycle
- java instanceof关键字
- HDU2594 Simpsons’ Hidden Talents KMP
- 直接插入排序
- 系统调用处理 暨 错误的包装函数
- MyEclipse集成svn的简单方法
- 感知机不能表示“异或”
- 为甚么 国企做互联网总做不起来?
- 更新一下智能插座研发进度