We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a250b7 commit 2b827f2Copy full SHA for 2b827f2
InvertBinaryTree.java
@@ -0,0 +1,19 @@
1
+/**
2
+ * Definition for singly-linked list.
3
+ * public class ListNode {
4
+ * int val;
5
+ * ListNode next;
6
+ * ListNode(int x) { val = x; }
7
+ * }
8
+ */
9
+class Solution {
10
+ public void deleteNode(ListNode node) {
11
+ // here we have access of only the node which is to be deleted
12
+ //so we will copy the value of next node in given node and we will delete next node;
13
+ //copying next node value;
14
+ node.val=node.next.val;
15
+ //deleting next node;
16
+ node.next=node.next.next;
17
+
18
+ }
19
+}
0 commit comments