We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a212d3 commit 429e698Copy full SHA for 429e698
delete-node-in-a-linked-list/delete-node-in-a-linked-list.cpp
@@ -0,0 +1,18 @@
1
+/**
2
+ * Definition for singly-linked list.
3
+ * struct ListNode {
4
+ * int val;
5
+ * ListNode *next;
6
+ * ListNode(int x) : val(x), next(NULL) {}
7
+ * };
8
+ */
9
+class Solution {
10
+public:
11
+ void deleteNode(ListNode* node) {
12
+ struct ListNode *temp = node->next;
13
+ node->val=temp->val;
14
+ node->next=temp->next;
15
+ delete(temp);
16
+
17
+ }
18
+};
0 commit comments