Related problems on LeetCode (easy)
2, 21, 82, 83, 86, 141, 160, 203, 206, 234, 237
Medium title
142
Skill
- Two pointers, one moves two steps and the other moves one step, so when one reaches the end, the other has reached the middle.
- Two pointers can also be used to detect whether there is a cycle.
- Never use dummy to create new linked lists.
This websiteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:
Original author:Jake Tao,source:Summary of LinkedList Problem-Solving Methods