All topics
4 patterns · 20 problems

Linked List

Pointer choreography — fast/slow runners, dummy heads, recursion, and in-place reversal.

01Pattern

Fast and Slow Pointers

Two runners at different speeds expose cycles and midpoints.

This patternO(1) spacenaïve O(n) space

When to reach for it

  • You have a problem where you need to find pairs of elements that meet certain conditions, such as the midpoint of the linked list, detecting cycles, or removing specific elements.

Spot it in the prompt

Look for problems that involve traversing the linked list efficiently using two pointers simultaneously, often requiring pointer manipulation or comparison.

Easy Bespoke animation

Linked List Cycle

LeetCode
Loading animation…

How to solve it

Move slow by one and fast by two; if they ever meet a cycle exists, otherwise fast reaches null.

Open full solution

Practice · 6 problems

Select any problem to watch the technique run. marks a problem with its own bespoke animation.

02Pattern

Dummy Node Technique

A placeholder head erases messy edge cases.

When to reach for it

  • You need to simplify edge cases, such as handling an empty list or adding/removing elements at the beginning.

Spot it in the prompt

Problems often involve scenarios where dealing with the head of the linked list is cumbersome or requires special treatment.

Medium

Add Two Numbers

LeetCode
Loading animation…

How to solve it

Animation: Dummy Node Technique technique

Traverse both lists adding digits plus carry, appending each sum node after a dummy head to simplify list construction.

Open full solution

Practice · 4 problems

Select any problem to watch the technique run. marks a problem with its own bespoke animation.

03Pattern

Recursion Technique

Let the call stack walk the list for you.

When to reach for it

  • Solving problems that require traversal or manipulation of the linked list structure in a recursive manner.

Spot it in the prompt

Look for problems where a recursive approach provides an elegant solution, such as dividing it into subproblems.

Medium

Swap Nodes in Pairs

LeetCode
Loading animation…

How to solve it

Animation: Recursion Technique technique

Recursively swap the first two nodes, then point the first at the result of swapping the remaining list.

Open full solution

Practice · 4 problems

Select any problem to watch the technique run. marks a problem with its own bespoke animation.

04Pattern

In-Place Reversal Technique

Rewire next pointers to reverse without extra space.

This patternO(1) spacenaïve O(n) space

When to reach for it

  • You need to reverse the linked list in-place without using extra space, typically by modifying the pointers iteratively.

Spot it in the prompt

Problems where you're asked to reverse the linked list or perform operations on segments without using additional data structures.

Easy

Reverse Linked List

LeetCode
Loading animation…

How to solve it

Animation: In-Place Reversal Technique technique

Iterate with prev, curr, and next pointers, redirecting each node's next to prev and advancing until the list is reversed.

Open full solution

Practice · 6 problems

Select any problem to watch the technique run. marks a problem with its own bespoke animation.

You've got the patterns

Patterns get you through the screen. Shipping gets you hired.

FDE Coach is a cohort-based program in frontend, backend, AWS, and AI where you build real products and get referred to 200+ hiring partners. The free live workshop is the fastest way to see how we teach.

750+ engineers trained · frontend, backend, AWS & AI

August 15 · 0d left
Enroll Now