Skip to content

Commit 4afdbd7

Browse files
committed
Update solution 203
1 parent 3746a94 commit 4afdbd7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 ListNode removeElements(ListNode head, int val) {
11+
if (head == null) {
12+
return null;
13+
}
14+
head.next = removeElements(head.next, val);
15+
return head.val != val ? head : head.next;
16+
}
17+
}

0 commit comments

Comments
 (0)