LeetCode131分割回文串
2026/4/14 14:37:10
classSolution{public:boolhasCycle(ListNode*head){ListNode*slow=head;ListNode*fast=head;if(head==nullptr||head->next==nullptr){returnfalse;}while(fast!=nullptr&&fast->next!=nullptr){slow=slow->next;fast=fast->next->next;if(slow==fast){returntrue;}}returnfalse;}};