leetcode题目链接 141. 环形链表
#include <stdio.h>
#include <stdbool.h>struct ListNode {int val;struct ListNode* next;
};
typedef struct ListNode ListNode;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;
}