recursion
recursion is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.
Interview Signal
Frequently tests problem modeling, edge handling, and verbal clarity.
Common Pitfall
Template-only answers break under follow-up questioning.
Practice Strategy
Practice in 3-5 problem rounds and always review complexity alternatives.
Recommended Progression
Pattern Bridge
High-Pressure Round
Add Two Numbers
Add Two Numbers requires careful linked-list pointer manipulation to sum digits while handling carries efficiently in in…
Regular Expression Matching
The Regular Expression Matching problem involves checking if a string matches a pattern using '.' and '*'.
Merge Two Sorted Lists
Merge two sorted linked lists by splicing nodes into one sorted list using linked-list pointer manipulation and recursio…
Swap Nodes in Pairs
Learn how to swap every adjacent linked-list pair by rewiring nodes safely without changing values or breaking the remai…
Reverse Nodes in k-Group
Reverse Nodes in k-Group challenges you to reverse segments of a linked list in groups of size k.
Wildcard Matching
Implement full wildcard pattern matching using '?' and '*' by applying state transition dynamic programming with careful…
Pow(x, n)
Calculate x to the power n efficiently using recursion and exponentiation, handling negative powers and large inputs saf…
Permutation Sequence
Find the kth permutation sequence of a set of numbers using math and recursion to efficiently compute the result.
Reorder List
Reorder List requires careful pointer manipulation in a singly linked list to interleave nodes from the ends without alt…
Remove Linked List Elements
Remove all nodes from a linked list that have a specific value, adjusting pointers to preserve the rest of the list.
Reverse Linked List
Reverse a singly linked list in place, converting the head to tail, with an iterative or recursive approach.
Basic Calculator
Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…
Power of Two
Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…
Number of Digit One
Compute the total number of digit one appearing in all numbers from 0 up to n using state transition dynamic programming…
Palindrome Linked List
Solve Palindrome Linked List by finding the midpoint, reversing the second half, and comparing mirrored nodes in linear …
Different Ways to Add Parentheses
Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.
Integer to English Words
Convert a given integer to its English words representation using mathematical logic and string manipulation.
Power of Three
Determine if a given integer is a power of three using math and recursion techniques.
Power of Four
Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.
Elimination Game
Elimination Game uses a systematic removal of numbers with alternating left-right passes, solvable with math and recursi…
Decode String
Decode a nested encoded string using stack-based state management, handling repeated patterns efficiently with recursion…
Predict the Winner
Predict the Winner involves two players taking turns to maximize their score by picking from either end of an array, opt…
Fibonacci Number
Calculate the nth Fibonacci number using state transition dynamic programming and recursive techniques efficiently in in…
Parse Lisp Expression
Parse Lisp expressions using stack-based state management to evaluate variables and operations.
Special Binary String
Solve the Special Binary String problem using string manipulation and recursion, optimizing lexicographical order.
Basic Calculator IV
Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…
K-th Symbol in Grammar
Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.
All Possible Full Binary Trees
Generate all possible full binary trees with n nodes, focusing on dynamic programming and binary tree traversal.
Parsing A Boolean Expression
Solve the "Parsing A Boolean Expression" problem by evaluating boolean expressions using stack-based state management, r…
Find Kth Bit in Nth Binary String
Determine the k-th bit in the n-th binary string using a recursive construction that inverts and reverses previous strin…
Maximize Number of Nice Divisors
Solve Maximize Number of Nice Divisors by splitting primeFactors into mostly 3s and using fast modular exponentiation.
Find the Winner of the Circular Game
Find the winner of a circular game by simulating the elimination process with a queue-driven approach.
Count Good Numbers
Count Good Numbers uses a mathematical pattern with recursion to efficiently count digit strings of length n under stric…
Minimum Non-Zero Product of the Array Elements
The problem asks to minimize the product of an array after performing bit-swapping operations on its binary representati…
Remove Nodes From Linked List
This problem requires removing nodes from a linked list when a larger node exists to their right, testing pointer manipu…
Count Collisions of Monkeys on a Polygon
Calculate the total number of monkey collisions on a convex polygon using math and recursion efficiently for large n.
Find the K-th Character in String Game I
Find the K-th character in a progressively built string using math and bit manipulation efficiently.
Find the K-th Character in String Game II
Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…
Unique 3-Digit Even Numbers
Given an array of digits, find how many distinct 3-digit even numbers can be formed without repetition of digits and no …
Partition Array into Two Equal Product Subsets
Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.