题目简介

LeetCode
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
typedef struct ListNode Node;
bool hasCycle(struct ListNode *head) {
Node* slow = head;
Node* fast = head;
while(fast && fast->next)
{
slow = slow->next;
fast = fast->next->next;
if(slow == fast)
{
return true;
}
}
return false;
}
博客主要介绍了LeetCode相关题目,虽内容简短,但聚焦于LeetCode题目这一信息技术领域常见的学习资源。
1万+

被折叠的 条评论
为什么被折叠?



