Build challenges · 4 steps · javascript · python

Singly Linked List

Construct a Singly Linked List with ListNode pointers, append, prepend, index-based insertion, deletion, and in-place reversal.

Unlike arrays that allocate contiguous memory blocks, a Linked List stores elements across independent nodes joined by memory pointers.

In this build, you will construct a Singly Linked List from scratch:

  1. Implement ListNode pointer chaining with $O(1)$ append and prepend.
  2. Implement index-based node access (getAt) and insertion (insertAt).
  3. Safely unlink and delete nodes while maintaining boundary references (deleteAt).
  4. Reverse the entire chain in-place with $O(1)$ auxiliary space (reverse).

The workspace

These files carry across every step. What you write in one step is what you start the next with.

Steps · 0 of 4 done

  1. Node Pointers & Boundary Insertion
  2. Index Access & Insertion
  3. Node Deletion
  4. In-Place Reversal

Start anywhere. Open step 3 first and you are handed the reference build of steps 1 and 2, so every step stands on its own. Nothing here is locked behind anything else.

This build applies Linked Lists. Read the lesson first if it is unfamiliar — a recommendation, not a prerequisite.

Shorter practice on the same ideas