File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .fishercoder .common .classes .ListNode ;
4
4
5
- /**
6
- * 203. Remove Linked List Elements
7
- *
8
- * Remove all elements from a linked list of integers that have value val.
9
- *
10
- * Example
11
- * Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6
12
- * Return: 1 --> 2 --> 3 --> 4 --> 5
13
- */
14
5
public class _203 {
15
6
public static class Solution1 {
16
7
/**
17
8
* This is a very good question to test your understanding of pointers/memory/addresses, although it's marked as EASY.
18
9
* All the three nodes: dummy, curr and prev are indispensable.
19
- *
10
+ * <p>
20
11
* 1. Eventually, we should return dummy.next as the final result.
21
12
* 2. we assign head to curr, dummy to prev
22
13
* 3. and then we use prev and curr to traverse through the list and do the work
You can’t perform that action at this time.
0 commit comments