aboutsummaryrefslogtreecommitdiff
path: root/other/linked_list_cycle2.cpp
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
committerJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
commita96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch)
treee2a2b3f49f9fb741be81415266ac93e74cff42ec /other/linked_list_cycle2.cpp
parent694ad5ed71edcb1deccab54b72d706b779918276 (diff)
downloadleetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz
leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/linked_list_cycle2.cpp')
-rw-r--r--other/linked_list_cycle2.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/other/linked_list_cycle2.cpp b/other/linked_list_cycle2.cpp
deleted file mode 100644
index 43dccea..0000000
--- a/other/linked_list_cycle2.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// 142. Linked List Cycle II
-#include "leetcode.h"
-
-/*
- * given 'head' of linked list, return node where the cycle begins. if there is
- * no cycle return null. there is a cycle in linked list of there is some node
- * in the list that can be reached again by continuously following the 'next'
- * pointer. internally, 'pos' is used to denote the index of the node that
- * tail's 'next' pointer is connected to. it is -1 if there is no cycle. note
- * 'pos' is not passed as parameter.
- */
-
-class Solution {
-public:
- ListNode *detectCycle(ListNode *head) {
- ListNode *slow = head, *fast = head;
- while (fast && fast->next) {
- slow = slow->next;
- fast = fast->next->next;
- if (slow == fast)
- break;
- }
- if (!(fast && fast->next))
- return NULL;
- while (head != slow) {
- head = head->next;
- slow = slow->next;
- }
- return head;
- }
-};