diff --git a/141_Linked_List_Cycle/.gitkeep b/141_Linked_List_Cycle/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/141_Linked_List_Cycle/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/141_Linked_List_Cycle/memo.md b/141_Linked_List_Cycle/memo.md deleted file mode 100644 index afd38a2..0000000 --- a/141_Linked_List_Cycle/memo.md +++ /dev/null @@ -1,14 +0,0 @@ -# step1 -- 構造体・ポインタの知識がなかったので,[これ](https://atcoder.jp/contests/apg4b)で学習. -- その上でリストの成分からなるvectorを用意して,p.nextがこのvector内のどれかを指していたらtrue,指す前にp.nextがnullに到達したらfalseを出力という方針で書いてみる. -- が,うまくいかず20分ほど経ったので回答を見る.鬼ごっこでやるのか,と感動. -- p.nextとするときとp->nextとするときがあって,pがポインタなら後者,ということか. - -# step2 -- 解答のコードや理屈がシンプルなこともあって,これ以上わかりやすく,というのがわからずstep1で生み出したものをそのままstep2として提出. - -# step3 -- 短いしいけるやろ,と思ったものの"!="を"=="と書いてしまいWA. -- その後3回Acceptedを出して終了 -- step2で他の人の回答を読むのを忘れていた. - - レビューは慣れてからで良かったみたい.とりあえずは読むことにしよう diff --git a/141_Linked_List_Cycle/step1.cpp b/141_Linked_List_Cycle/step1.cpp deleted file mode 100644 index 184fbdb..0000000 --- a/141_Linked_List_Cycle/step1.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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) { - ListNode *fast = head; - ListNode *slow = head; - - while(fast != nullptr && fast->next != nullptr){ - fast = fast->next->next; - slow = slow->next; - - if(fast == slow) return true; - - } - - return false; - } -}; diff --git a/141_Linked_List_Cycle/step2.cpp b/141_Linked_List_Cycle/step2.cpp deleted file mode 100644 index 184fbdb..0000000 --- a/141_Linked_List_Cycle/step2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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) { - ListNode *fast = head; - ListNode *slow = head; - - while(fast != nullptr && fast->next != nullptr){ - fast = fast->next->next; - slow = slow->next; - - if(fast == slow) return true; - - } - - return false; - } -}; diff --git a/141_Linked_List_Cycle/step3.cpp b/141_Linked_List_Cycle/step3.cpp deleted file mode 100644 index d5e3779..0000000 --- a/141_Linked_List_Cycle/step3.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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) { - ListNode *fast = head; - ListNode *slow = head; - - while(fast != nullptr && fast->next != nullptr){ - fast = fast->next->next; - slow = slow->next; - - if(fast == slow) return true; - } - return false; - } -};