diff options
author | Jack Sangdahl <[email protected]> | 2025-02-03 15:37:19 -0700 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-02-03 15:37:19 -0700 |
commit | 55a67f776dd9acd258cae16ffb636751666b0f40 (patch) | |
tree | 601539de43809b70ceb8228a12c35883fa300b03 /remove_node.cpp | |
parent | a0030873dabb517594ae0394350d6715071f7fb8 (diff) | |
download | leetcode-55a67f776dd9acd258cae16ffb636751666b0f40.tar.gz leetcode-55a67f776dd9acd258cae16ffb636751666b0f40.zip |
chore: Remove incomplete solutions
Diffstat (limited to 'remove_node.cpp')
-rw-r--r-- | remove_node.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/remove_node.cpp b/remove_node.cpp deleted file mode 100644 index 1f79374..0000000 --- a/remove_node.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <bits/stdc++.h> -#include <cstddef> -using namespace std; - -struct ListNode { - int val; - ListNode *next; - ListNode() : val(0), next(nullptr) {} - ListNode(int x) : val(x), next(nullptr) {} - ListNode(int x, ListNode *next) : val(x), next(next) {} -}; - -class Solution { -public: - ListNode *removeNthFromEnd(ListNode *head, int n) { - ListNode *temp = head; - for (int i = 0; i < n; i++) - temp = temp->next; - if (temp == NULL) - return head->next; - ListNode *curr = head; - while (temp->next) { - temp = temp->next; - curr = curr->next; - } - curr->next = curr->next->next; - return head; - } -}; - -int main() {} |