KarmaCoder Day 3 LC203/707/206
1️⃣ Remove Linked List Elements Link: lc203
Takeaway:microphone::
- ListNode construction: value, next
- Often the process is we find a node, and do some operations on it. Thus, it’s most convenient to identify this node at its previous node, and at the same time, store the pointer to its next node.
- Creating a dummy node ahead of the head node allows us to process the head node as other nodes.
2️⃣ Design linked list
- When designing a linked list, initialize a dummy head, then add elements one by one.
3️⃣ Reverse linked list
- Two pointers, one is cur, the other is pre
- Temporarily save current node’s next node because we will change it to the previous node.