aboutsummaryrefslogtreecommitdiff
path: root/other/delete_middle_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/delete_middle_node.cpp')
-rw-r--r--other/delete_middle_node.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/other/delete_middle_node.cpp b/other/delete_middle_node.cpp
deleted file mode 100644
index 1493046..0000000
--- a/other/delete_middle_node.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- ListNode *deleteMiddle(ListNode *head) {
- if (head->next == nullptr)
- return nullptr;
- auto slow = head, fast = head->next->next;
- while (fast != nullptr && fast->next != nullptr) {
- fast = fast->next->next;
- slow = slow->next;
- }
- slow->next = slow->next->next;
- return head;
- }
-};