Data Structures & Memory Alignment
Master dynamic memory allocation, contiguous arrays, linked lists, binary search trees, and heap buffer layout.
Reverse Singly Linked List In-Place
Given the `head` of a singly linked list, reverse the list in-place by mutating node pointers and return the new head pointer.
Min Stack with O(1) Auxiliary Retrieval
Design a stack structure supporting `push(val)`, `pop()`, `top()`, and `getMin()`, where all operations execute in constant O(1) time.
Queue Implementation via Two Stacks
Implement a first-in first-out (FIFO) queue using only two standard LIFO stacks. Support `push`, `pop`, `peek`, and `empty`.
Array Circular Right Shift In-Place
Given an integer array `nums`, rotate the array to the right by `k` steps in-place using constant auxiliary space.
Floyd's Cycle Detection & Loop Node Search
Given the `head` of a linked list, return the node where the cycle begins. If there is no cycle, return `null`.
Merge Two Sorted Linked Lists In-Place
You are given the heads of two sorted linked lists `list1` and `list2`. Merge the two lists into one sorted list by splicing together nodes in-place.
Remove Nth Node From End of Singly Linked List
Given the `head` of a linked list, remove the `n`-th node from the end of the list and return its head in a single pass.
Intersection Node of Two Linked Lists
Given the heads of two singly linked lists `headA` and `headB`, return the node at which the two lists intersect. If the two linked lists have no intersection, return `null`.
Palindrome Linked List Pointer Verification
Given the `head` of a singly linked list, return `true` if it is a palindrome or `false` otherwise. Solve in O(N) time and O(1) space.
LRU Cache O(1) Doubly-Linked List + Hash Map
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement `get(key)` and `put(key, value)` both running in average O(1) time complexity.
Target Value Search & Index Bounds (Variant 2)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 2)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 2)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 2)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 2)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 2)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 2)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 2)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 2)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 2)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 2: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 3)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 3)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 3)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 3)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 3)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 3)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 3)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 3)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 3)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 3)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 3: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 4)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 4)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 4)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 4)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 4)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 4)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 4)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 4)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 4)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 4)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 4: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 5)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 5)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 5)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 5)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 5)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 5)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 5)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 5)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 5)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 5)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 5: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 6)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 6)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 6)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 6)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 6)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 6)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 6)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 6)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 6)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 6)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 6: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 7)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 7)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 7)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 7)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 7)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 7)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 7)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 7)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 7)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 7)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 7: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 8)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 8)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 8)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 8)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 8)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 8)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 8)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 8)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 8)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 8)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 8: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 9)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 9)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 9)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 9)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 9)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 9)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 9)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 9)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 9)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 9)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 9: Enforces strict boundary checks and memory limits].
Target Value Search & Index Bounds (Variant 10)
Given a sorted array of N numbers, find target value index using binary boundary checks. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Maximum Profit Stock Trading Window (Variant 10)
Calculate maximum profit achievable from single buy/sell transaction sequence over N days. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Valid Parentheses Expression Parser (Variant 10)
Determine if input string containing brackets '()[]{}' is valid using a LIFO stack. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Container With Most Water Dual Pointers (Variant 10)
Find two lines that together with x-axis form a container holding the most water. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Three Sum Zero Triplet Search (Variant 10)
Find all unique triplets in array [a,b,c] such that a + b + c = 0. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Climbing Stairs Dynamic Programming (Variant 10)
Count distinct ways to climb N stairs taking 1 or 2 steps per turn. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Course Schedule Topological Cycle Check (Variant 10)
Determine if you can finish all V courses given prerequisite pair requirements. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Word Ladder Shortest Transformation BFS (Variant 10)
Find shortest transformation sequence length from startWord to endWord using wordList. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Serialize and Deserialize Binary Tree (Variant 10)
Design an algorithm to serialize a binary tree to string and deserialize back to tree. [Rigor Variation 10: Enforces strict boundary checks and memory limits].
Sliding Window Maximum Deque Filter (Variant 10)
Find maximum element in sliding window of size K moving from left to right. [Rigor Variation 10: Enforces strict boundary checks and memory limits].