intro practice · coding problem

Merge Two Sorted Lists

LeetCode #21 — Merge Two Sorted Lists. Solve on LeetCode, then implement here if you want it in your drill queue. https://leetcode.com/problems/merge-two-sorted-lists/

The mechanism

A linked list trades fast random access for fast inserts and deletes wherever you already have a pointer. The classic moves: a dummy head to simplify edge cases, two pointers (fast and slow), and reversing in place.

Study Linked List

Expected evidence

Pass all LeetCode test cases for this problem.

Try this drill in the practice workspace →

Hints when you need them
  • Pattern hint: linked list.
  • Start with brute force, then optimize time/space.
  • Write down invariants before coding.

Check the sources

Practice the same mechanism

Browse all practice briefs