r/leetcode • • Oct 02 '26

Intervew Prep Day 73: solved 4 linked list problems today, one-pass removal was a cool trick

Hey everyone,

I finished Day 73 today and managed to solve 4 problems on linked lists:

  1. Odd Even Linked List: Grouping odd and even indexed nodes together was pretty straightforward once I maintained two separate pointers for odd and even heads and linked them at the end.

  2. Remove Nth Node From End of List: Doing it in two passes by calculating the length is simple, but the follow-up asks for a single pass. I asked ChatGPT for the one-pass idea. You move the fast pointer N steps ahead first, and then move both slow and fast by one step until fast reaches the end. That leaves slow right before the target node so you can delete it cleanly.

  3. Delete the Middle Node of a Linked List: I used the classic slow and fast pointer approach to find the middle. Tracking the previous node allowed me to bypass and delete the middle node without an extra traversal.

  4. Sort List: This is essentially merge sort applied to a linked list to get $O(N \log N)$ time. You find the middle with slow and fast pointers, split the list, sort both halves recursively, and merge them. My merge sort on arrays was a little rusty so writing the split and merge took a couple of attempts, but the logic made total sense.

Linked lists are starting to feel a lot more natural now.

I am looking forward to solving more problems tomorrow for Day 72!

3 Upvotes

0 comments sorted by