Tags

Singly Linked List

Singly Linked List

5 lessons
18 problems
2 code snippets
3 question banks
9 community items

linked-list

Data Structures

4 lessons

Circular Linked List

Intermediate

45 min

1 prereq

An operating system rotating turns among four CPU-bound processes, a music player on shuffle-repeat, and the classic Josephus problem all share the same shape: a finite list of items consulted in cyclical order, where 'after the last' means 'back to the first'. A **Circular Linked List** encodes that shape directly, with the last node's `next` pointer wired to the head instead of `null`. This lesson covers the circular singly linked list and its doubly linked variant, the stop condition for traversal (return to the starting node rather than waiting for `null`), insertion at the head and at the tail in `O(1)` when a tail pointer is maintained, and deletion that correctly handles the wrap-around. You will also compare circular structures with the standard linear forms so you know when bending the list back on itself is the right call and when it just complicates traversal. In **Linked Lists (Singly)**, traversal terminated when you reached a `null` next pointer; here, the same loop must compare against the starting node instead, a small change that exposes the distinction between cycle detection and cycle definition (Floyd's tortoise-and-hare reuses this idea later). With all three linked-list shapes covered, the curriculum next pivots to tree-based and array-based structures with stronger time guarantees.

Not Started

0%

Circular Linked List
Singly Linked List
Data Structures
Intermediate
Premium
Time Complexity
Space Complexity
Comparison

Doubly Linked List

Intermediate

45 min

1 prereq

Deleting a node from a singly linked list when you only hold a pointer to that node is genuinely awkward: you need the previous node too, and finding it is `O(n)`. Add a `prev` pointer to every node and the same delete becomes four pointer rewires in `O(1)`, which is exactly the upgrade that powers LRU caches and the browser back-forward stack. This lesson covers the **Doubly Linked List** node layout (`value`, `next`, `prev`), bidirectional traversal, insertion at head and tail and after a given node, deletion by node reference and by value, and the sentinel (dummy head and tail) pattern that eliminates almost all null-check edge cases in pointer-heavy code. You will also weigh the per-node memory cost of the extra pointer against the operations it unlocks. In **Linked Lists (Singly)**, head insertion was already `O(1)` but mid-list deletion required carrying a trailing pointer during traversal. The doubly linked list removes that constraint: every node knows its predecessor, so you can splice it out without any extra bookkeeping. Next, **Circular Linked List** keeps a single direction of links but bends the list back on itself, which turns out to be the right shape for round-robin scheduling and circular buffers.

Not Started

0%

Doubly Linked List
Singly Linked List
Data Structures
Intermediate
Premium
Time Complexity
Space Complexity
Comparison

Linked Lists (Singly)

Free
Beginner

45 min

2 prereqs

Inserting at the front of an array of one million items forces every existing element to slide one slot to the right. A **Linked List** sidesteps that copy entirely: a head insertion is two pointer assignments and nothing else, no matter how many nodes follow. In this lesson, each node holds a value and a `next` reference, and you chain those nodes into a singly linked list with explicit head and optional tail pointers. You will implement traversal, head and tail and middle insertion, deletion by value and by position, and linear search, and you will analyze each operation precisely so the trade-off against arrays becomes concrete: `O(1)` insertion at the head, `O(n)` access by index, and per-node memory overhead for the pointer. In **Arrays & Strings**, the `O(n)` cost of inserting near the front came from shifting; the linked list was invented to remove that shift. **Memory Models** introduced the difference between a contiguous block on the stack or heap and scattered allocations connected by references, and that mental model is exactly how a node-based structure lives in memory. Once you are comfortable manipulating `next` pointers, **Stack (LIFO)** uses a linked list (or a dynamic array) as its underlying storage and adds a strict push, pop, peek discipline on top.

Not Started

0%

Singly Linked List
Data Structures
Beginner
Free
Time Complexity
Space Complexity
Memory Models
Fundamentals
Pointers

Skip List

Intermediate

50 min

1 prereq

Redis backs its sorted sets with one. LevelDB and RocksDB use one for their in-memory memtables. Java ships a `ConcurrentSkipListMap` in its standard library because lock-free skip lists are dramatically easier to implement than lock-free balanced BSTs. The structure those production systems share is a **Skip List**: a sorted linked list with a few extra express-lane pointers that turn `O(n)` search into `O(log n)` expected. This lesson covers the multi-level structure (a base list with every element, plus higher levels each containing a random subset that acts as a fast-path index), the coin-flip promotion rule that decides how many levels each new node spans, and search, insert, and delete operations whose expected cost is logarithmic without any tree rotations or balance bookkeeping. You will trace the search path that drops one level at a time whenever the next pointer overshoots the target, and you will analyze why a fair coin produces the right level distribution. In **Linked Lists (Singly)**, a search was `O(n)` because the list offered exactly one pointer per node. A skip list keeps that simple node, just adds a small array of forward pointers to higher levels, and lets randomness substitute for the deterministic balancing that AVL and Red-Black trees rely on. Next, **Balanced BST (AVL / Red-Black)** is the deterministic counterpart: same logarithmic guarantees, fundamentally different implementation strategy.

Not Started

0%

Skip List
Singly Linked List
Data Structures
Intermediate
Premium
Randomized Algorithms
Probability Basics
Searching
Comparison

Algorithms

1 lesson

Linked List Algorithms

Intermediate

55 min

2 prereqs

Reversing a singly linked list is a four-line iteration with three pointers (`prev`, `curr`, `next`), and yet roughly a third of candidates implement it incorrectly under interview pressure. The reason is that linked-list problems give you no random access: every operation has to be expressed as careful, ordered pointer rewrites, and one missed assignment loses the rest of the list forever. **Linked List Algorithms** is the lesson where pointer manipulation becomes a reliable skill. You will reverse a list iteratively and recursively, then extend the technique to reverse in groups of `k`. You will use Floyd's fast and slow pointers to detect cycles, find the cycle start, locate the middle element, and check whether a list is a palindrome. You will merge two sorted lists, then merge `k` sorted lists with a min-heap. The lesson also covers removing the nth node from the end, finding the intersection of two lists, deep-copying a list with random pointers, and the dummy-node trick that eliminates head-edge cases entirely. In **Linked Lists (Singly)**, you saw how nodes and `next` pointers form a list and why insertion at a known position is `O(1)`. **Two Pointers (Intro)** introduced fast and slow indices on arrays; this lesson reuses the same idea on pointer-linked nodes. Next, **Tree Algorithms** generalizes pointer-and-recursion thinking to branching structures.

Not Started

0%

Algorithms
Singly Linked List
Fast/Slow Pointers
Two Pointers
Cycle Detection
Patterns
Intermediate
Premium

Practice Problems

18 problems

Linked List Cycle

Free
Not Started
Easy

Given the head of a linked list, determine if the linked list has a cycle in it.

Singly Linked List
Fast/Slow Pointers
Cycle Detection
Beginner

1.1k

19

Merge Two Sorted Lists

Free
Not Started
Easy

Merge two sorted linked lists into one sorted linked list by splicing the nodes together.

Singly Linked List
Two Pointers
Recursion
Beginner

487

4

Middle of the Linked List

Free
Not Started
Easy

Given the head of a singly linked list, return the middle node. If there are two middle nodes, return the second one.

Singly Linked List
Fast/Slow Pointers
Beginner

731

23

Reverse Linked List

Free
Not Started
Easy

Given the head of a singly linked list, reverse the list and return the new head.

Singly Linked List
Pointers
Recursion
Beginner

262

4

Merge k Sorted Lists

Free
Not Started
Hard

Merge k sorted linked lists into one sorted linked list using a divide-and-conquer or min-heap approach.

Singly Linked List
Heap
Divide and Conquer
Advanced

1.1k

28

Reverse Nodes in k-Group

Free
Not Started
Hard

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. Nodes left over at the end that are fewer than k should remain in their original order.

Singly Linked List
Pointers
Recursion
Advanced

885

19

Add Two Numbers

Free
Not Started
Medium

Given two non-empty linked lists representing two non-negative integers in reverse order, add the two numbers and return the sum as a linked list.

Singly Linked List
Pointers
Intermediate

541

9

Copy List with Random Pointer

Free
Not Started
Medium

Create a deep copy of a linked list where each node has a next pointer and a random pointer that can point to any node in the list or null.

Singly Linked List
Hash Map / Dictionary
Intermediate

708

7

Find the Duplicate Number

Free
Not Started
Medium

Given an array of n + 1 integers where each integer is in the range [1, n], find the one duplicate number without modifying the array and using only constant extra space.

Singly Linked List
Fast/Slow Pointers
Cycle Detection
Intermediate

1.1k

36

LRU Cache

Free
Not Started
Medium

Design a data structure that follows the Least Recently Used (LRU) cache constraints, supporting get and put operations in O(1) time.

Singly Linked List
Doubly Linked List
Hash Map / Dictionary
LRU Cache
Intermediate

761

9

Partition List

Free
Not Started
Medium

Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x, preserving the original relative order.

Singly Linked List
Two Pointers
Intermediate

771

11

Remove Duplicates from Sorted List II

Free
Not Started
Medium

Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.

Singly Linked List
Pointers
Intermediate

154

4

Remove Nth Node From End of List

Free
Not Started
Medium

Given the head of a linked list, remove the nth node from the end of the list and return its head.

Singly Linked List
Two Pointers
Intermediate

171

2

Reorder List

Free
Not Started
Medium

Reorder a linked list from L0 -> L1 -> ... -> Ln to L0 -> Ln -> L1 -> Ln-1 -> L2 -> Ln-2 -> ... in-place.

Singly Linked List
Fast/Slow Pointers
Two Pointers
Intermediate

227

3

Reverse Linked List II

Free
Not Started
Medium

Given the head of a singly linked list and two integers left and right, reverse the nodes of the list from position left to position right, and return the reversed list.

Singly Linked List
Pointers
Intermediate

681

20

Rotate List

Free
Not Started
Medium

Given the head of a linked list, rotate the list to the right by k places.

Singly Linked List
Pointers
Intermediate

702

20

Sort List

Free
Not Started
Medium

Given the head of a linked list, sort it in ascending order using O(n log n) time and O(1) or O(log n) space.

Divide and Conquer
Singly Linked List
Merge Sort
Sorting
Recursion
Intermediate

652

21

Swap Nodes in Pairs

Free
Not Started
Medium

Given a linked list, swap every two adjacent nodes and return its head. You must solve it without modifying the values in the list's nodes.

Singly Linked List
Pointers
Recursion
Intermediate

490

11

Community

9 items
Problem
Medium
Free

Design HashMap

Implement a HashMap from scratch using a fixed bucket array with separate chaining; support put / get / remove on integer keys.

hash-map
hash-table
linked-list

312

2

4.3 (9)

May 11, 2026

by @chloekelly

Problem
Medium
Free

Odd Even Linked List

Reorder a singly-linked list so all odd-positioned nodes come before even-positioned ones, in O(n) time and O(1) space using two interleaved sub-lists.

linked-list
two-pointers

512

3

4.5 (13)

Mar 27, 2026

by @nehawood

Problem
Easy
Free

Intersection of Two Linked Lists

Find the node where two singly-linked lists merge using the two-pointer rendezvous trick that runs in O(m + n) time and O(1) space.

linked-list
two-pointers
hash-table

709

4

Mar 1, 2026

by @folakemansour

Problem
Medium
Free

Design Linked List

Implement a singly-linked list class with index-based get / addAtHead / addAtTail / addAtIndex / deleteAtIndex, using a sentinel head and a size counter for O(1) bound checks.

linked-list
data-structures

583

18

4.5 (10)

Feb 23, 2026

by @noranasser

Problem
Easy
Free

Palindrome Linked List

Decide whether a singly-linked list reads the same forward and backward in O(n) time and O(1) space using fast/slow pointers plus an in-place reverse of the second half.

linked-list
two-pointers

974

12

4.6 (16)

Feb 21, 2026

by CodeSnatch

Problem
Easy
Free

Remove Linked List Elements

Delete every node in a singly-linked list whose value matches a target, with a sentinel/dummy node that makes the head case fall out of the general loop.

linked-list
recursion

699

19

4.5 (9)

Jan 17, 2026

by @jameszhang

Problem
Medium
Free

Flatten a Multilevel Doubly Linked List

Flatten a doubly-linked list whose nodes may have a child pointer to another doubly-linked list, producing a single-level list via DFS or an explicit stack.

linked-list
stack
recursion

493

8

4.5 (13)

Jan 11, 2026

by @vikramokoro

Article

Linked Lists Explained

What linked lists actually buy you in modern code, the operations that make them shine, and why the answer is usually "use an array" anyway.

linked-list
doubly-linked-list
data-structures
fundamentals
interview-prep

1.1k

25

4.5 (13)

Jan 2, 2026

by @sanjayward

Problem
Hard
$9.99

LFU Cache

Implement a Least Frequently Used (LFU) cache with O(1) get and put using a frequency-bucket map plus per-bucket doubly linked lists.

lfu-cache
hash-table
linked-list

1k

5

4.3 (17)

Nov 29, 2025

by CodeSnatch