Skip to content

Commit 85c902e

Browse files
update
1 parent e4b551c commit 85c902e

7 files changed

Lines changed: 23 additions & 0 deletions

4 Other Problems/InorderTraversalIterative.java renamed to 1 Leetcode Easy Problems/LeetCode 94 Binary Tree Inorder Traversal using Iteration.java

File renamed without changes.

4 Other Problems/InorderTraversalRecursive.java renamed to 1 Leetcode Easy Problems/LeetCode 94 Binary Tree Inorder Traversal using Recursion.java

File renamed without changes.

4 Other Problems/PreorderTraversalIterative.java renamed to 1 Leetcode Easy Problems/Leetcode 144 Binary Tree Preorder Traversal using Iterative - Java Video Solution.java

File renamed without changes.

4 Other Problems/PreorderTraversalRecursive.java renamed to 1 Leetcode Easy Problems/Leetcode 144 Binary Tree Preorder Traversal using Recursion - Java Video Solution.java

File renamed without changes.

4 Other Problems/PostorderTraversalIterative.java renamed to 1 Leetcode Easy Problems/Leetcode 145 Binary Tree Postorder Traversal using Iteration.java

File renamed without changes.

4 Other Problems/PostorderTraversalRecursive.java renamed to 1 Leetcode Easy Problems/Leetcode 145 Binary Tree Postorder Traversal using Recursion.java

File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Definition for singly-linked list.
3+
* public class ListNode {
4+
* int val;
5+
* ListNode next;
6+
* ListNode() {}
7+
* ListNode(int val) { this.val = val; }
8+
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
9+
* }
10+
*/
11+
class Solution {
12+
public ListNode deleteDuplicates(ListNode head) {
13+
ListNode current = head;
14+
while (current != null && current.next != null) {
15+
if (current.val == current.next.val) {
16+
current.next = current.next.next;
17+
} else {
18+
current = current.next;
19+
}
20+
}
21+
return head;
22+
}
23+
}

0 commit comments

Comments
 (0)