Search
Search every question and quick fact in the course.
Everything, A to Z (280)
- 1-bit counts for every number from 0 to n Question · Bits and maths
- [[0] * n for _ in range(m)] Quick fact · Dynamic programming
- A stack that also reports its minimum Question · Stacks and queues
- Add a booking to a sorted list of separate blocks Question · Greedy choices and intervals
- Adjacency list size Quick fact · Graphs
- Adjacency list, adjacency matrix or edge list? Question · Graphs
- Amortised cost: cheap on average, sometimes slow Question · Complexity analysis
- Answer many range-total questions quickly Question · Complexity analysis
- Apply the backspaces in typed text Question · Stacks and queues
- Are two trees identical? Question · Trees
- Area of the biggest patch of land Question · Graphs
- assert for quick tests Quick fact · Interview craft
- Best haul when the lockers form a ring Question · Dynamic programming
- Best haul without opening two neighbouring lockers Question · Dynamic programming
- Best single buy-then-sell on a price history Question · Sliding window
- Best total over k consecutive days Question · Sliding window
- Best, average and worst case Question · Complexity analysis
- BFS or DFS: which one to use Question · Graphs
- Big O in plain words Question · Complexity analysis
- Binary search on the answer Question · Searching sorted data
- Binary search without off-by-one bugs Question · Searching sorted data
- bisect key argument Quick fact · Searching sorted data
- bisect.bisect_left Quick fact · Searching sorted data
- bisect.bisect_right Quick fact · Searching sorted data
- Bit tricks worth knowing Question · Bits and maths
- Brute force first, then improve Question · Interview craft
- Build a queue out of two stacks Question · Stacks and queues
- Busiest hour in each k-hour span Question · Sliding window
- Cache arguments must be hashable Quick fact · Dynamic programming
- Can a string be split into dictionary words? Question · Dynamic programming
- Can every task finish, given its prerequisites? Question · Graphs
- Can you hop to the last tile? Question · Greedy choices and intervals
- Cells whose rain reaches both coasts Question · Graphs
- Cheapest route from top-left to bottom-right Question · Dynamic programming
- Cheapest way to cable every office together Question · Graphs
- Cheapest way to join ropes into one Question · Heaps and priority queues
- Closest shared ancestor in a search tree Question · Trees
- collections.deque Quick fact · Sliding window
- collections.deque Quick fact · Stacks and queues
- collections.deque Quick fact · Linked lists
- collections.deque for BFS Quick fact · Trees
- Combine overlapping bookings into blocks Question · Greedy choices and intervals
- Copying the path Quick fact · Backtracking
- Count or sort: choosing a frequency tool Question · Arrays, strings and hash maps
- Count position pairs whose values differ by exactly k Question · Interview craft
- Count sales stretches that add up to a target Question · Arrays, strings and hash maps
- Count the 1 bits in a number Question · Bits and maths
- Count the picks that hit an exact total Question · Backtracking
- Count the separate patches of land on a map Question · Graphs
- Count the stretches that read the same backwards Question · Strings and tries
- Count the ways to place queens that cannot attack Question · Backtracking
- Count weight triples that stay under a limit Question · Two pointers
- Cut a string into the most chunks so no letter crosses a cut Question · Greedy choices and intervals
- Cut a word into pieces that each read the same backwards Question · Backtracking
- @dataclass Quick fact · Trees
- @dataclass(eq=False) Quick fact · Linked lists
- deque(maxlen=k) Quick fact · Sliding window
- Dict order Quick fact · Arrays, strings and hash maps
- Dijkstra cost Quick fact · Graphs
- Do the brackets in a line balance? Question · Stacks and queues
- Do two sorted prices add up to a target? Question · Two pointers
- Does a banner read the same both ways? Question · Two pointers
- Does a chain read the same backwards? Question · Linked lists
- Does a dependency graph contain a loop? Question · Graphs
- Does a root-to-leaf route add up to a target? Question · Trees
- Does a tree mirror itself? Question · Trees
- Does the chain loop back on itself? Question · Linked lists
- Drop the k-th link from the end Question · Linked lists
- Dry run Quick fact · Interview craft
- Dry run: the first day an account is overdrawn Question · Interview craft
- Dynamic programming in four steps Question · Dynamic programming
- Each shelf's product of all the other shelves Question · Arrays, strings and hash maps
- Evaluate an expression written in postfix order Question · Stacks and queues
- Every balanced string of n bracket pairs Question · Backtracking
- Every distinct order when songs repeat Question · Backtracking
- Every order of a playlist Question · Backtracking
- Every selection from a set of toppings Question · Backtracking
- Every team of k from n players Question · Backtracking
- Fastest delivery time to every depot Question · Graphs
- Fewest bookings to cancel so none clash Question · Greedy choices and intervals
- Fewest coins to make an amount Question · Dynamic programming
- Fewest edits to turn one word into another Question · Dynamic programming
- Fewest hops between two stations Question · Graphs
- Fewest hops to the last tile Question · Greedy choices and intervals
- Fewest one-letter changes between two code words Question · Graphs
- Fewest time slots when each job type needs a cooldown Question · Heaps and priority queues
- Fill in the water that does not touch the edge Question · Graphs
- Find a value in a grid sorted row after row Question · Searching sorted data
- Find a value in a rotated sorted list Question · Searching sorted data
- Find the balance point of a seesaw Question · Arrays, strings and hash maps
- Find the value that fills more than half the list Question · Arrays, strings and hash maps
- First and last position of a value in a sorted list Question · Searching sorted data
- First order code that appears only once Question · Arrays, strings and hash maps
- First place a pattern appears in a text Question · Strings and tries
- Fixed-size vs variable-size windows Question · Sliding window
- Fold a chain: first, last, second, second-last Question · Linked lists
- functools.cache Quick fact · Dynamic programming
- Grids are graphs: neighbours, bounds and costs Question · Graphs
- Group tile racks that hold the same letters Question · Arrays, strings and hash maps
- Half-open intervals Quick fact · Greedy choices and intervals
- hash(-1) in CPython Quick fact · Arrays, strings and hash maps
- Heap, sort or quickselect? Question · Heaps and priority queues
- Heap-style indexes Quick fact · Trees
- heapq is a min-heap Quick fact · Graphs
- heapq is a min-heap Quick fact · Heaps and priority queues
- heapq.heapify Quick fact · Heaps and priority queues
- heapq.nlargest and nsmallest Quick fact · Heaps and priority queues
- Highest point of a climb-then-descent route Question · Searching sorted data
- How a binary heap works Question · Heaps and priority queues
- How a hash map keeps lookups fast on average Question · Arrays, strings and hash maps
- How big is the search space? Question · Backtracking
- How deep is the deepest branch? Question · Trees
- How fast can sorting be? Question · Complexity analysis
- How linked-list questions give you the chain Question · Linked lists
- How many days until a warmer day? Question · Stacks and queues
- How many requests arrived in the recent window? Question · Stacks and queues
- How many rooms do the bookings need at once? Question · Greedy choices and intervals
- How many separate groups does a network have? Question · Graphs
- How many words start with a given prefix? Question · Strings and tries
- How to tell a problem needs DP Question · Dynamic programming
- How trees are written on these pages Question · Trees
- In place or a new list: what the interviewer means Question · Two pointers
- Input limits hint at cost Quick fact · Interview craft
- int() truncates toward zero Quick fact · Stacks and queues
- int.bit_count() Quick fact · Bits and maths
- int.bit_length() Quick fact · Bits and maths
- Is a short route hidden inside a long one? Question · Two pointers
- Is every node's left and right height within one? Question · Trees
- Is this a valid binary search tree? Question · Trees
- itertools.accumulate Quick fact · Sliding window
- itertools.combinations Quick fact · Backtracking
- itertools.permutations Quick fact · Backtracking
- itertools.product Quick fact · Backtracking
- Kotlin ArrayDeque Quick fact · Sliding window
- Kotlin ArrayDeque Quick fact · Stacks and queues
- Kotlin binarySearch Quick fact · Searching sorted data
- Kotlin bit operators Quick fact · Bits and maths
- Kotlin HashMap vs LinkedHashMap Quick fact · Arrays, strings and hash maps
- Kotlin LinkedList Quick fact · Linked lists
- Kotlin MutableList swap Quick fact · Two pointers
- Kotlin nullable children Quick fact · Trees
- Kotlin PriorityQueue Quick fact · Graphs
- Kotlin PriorityQueue Quick fact · Heaps and priority queues
- Kotlin sortedBy Quick fact · Greedy choices and intervals
- Kotlin StringBuilder Quick fact · Strings and tries
- Kotlin windowed Quick fact · Sliding window
- Largest poster that fits under a skyline Question · Stacks and queues
- Largest product of a contiguous run Question · Dynamic programming
- Largest total of a contiguous run Question · Greedy choices and intervals
- List a tree's values row by row Question · Trees
- list.append cost Quick fact · Arrays, strings and hash maps
- list.insert(0, x) cost Quick fact · Complexity analysis
- list.sort(key=...) Quick fact · Greedy choices and intervals
- Longest path between any two nodes Question · Trees
- Longest rising sequence of picks from a list Question · Dynamic programming
- Longest run of consecutive ticket numbers Question · Arrays, strings and hash maps
- Longest shared subsequence of two strings Question · Dynamic programming
- Longest single-colour run after repainting k tiles Question · Sliding window
- Longest start shared by every word Question · Strings and tries
- Longest streak of days within a budget Question · Sliding window
- Longest stretch of a log with no letter seen twice Question · Sliding window
- Longest stretch that reads the same backwards Question · Strings and tries
- Longest stretch with at most two kinds Question · Sliding window
- Look up words where '.' stands for any letter Question · Strings and tries
- Mark visited when you push or when you pop? Question · Graphs
- math.inf for 'impossible' Quick fact · Dynamic programming
- math.isqrt Quick fact · Searching sorted data
- Median after each new reading Question · Heaps and priority queues
- Merge many sorted feeds into one Question · Heaps and priority queues
- Merge two sorted shelves into one Question · Two pointers
- Minutes until every item on a shelf spoils Question · Graphs
- Negative numbers and >> Quick fact · Bits and maths
- Number of ways to pay an amount with unlimited coins Question · Dynamic programming
- operator.itemgetter Quick fact · Greedy choices and intervals
- pow(b, e, m) Quick fact · Complexity analysis
- Pre-order, in-order, post-order and level order Question · Trees
- Pruning: making exponential searches fast enough Question · Backtracking
- Push the empty parking slots to the end Question · Two pointers
- Push values into a min-heap by hand Question · Heaps and priority queues
- Python list as a stack Quick fact · Stacks and queues
- Python list is an array Quick fact · Linked lists
- Python recursion limit Quick fact · Trees
- Python sort algorithm Quick fact · Two pointers
- Python's breakpoint() Quick fact · Interview craft
- queue.Queue vs deque Quick fact · Stacks and queues
- Raise a number to a huge power, modulo m Question · Complexity analysis
- Reading the cost of loops Question · Complexity analysis
- Recursion depth and when to walk a tree iteratively Question · Trees
- Recursion depth in top-down DP Quick fact · Dynamic programming
- Recursion is a stack: converting to an explicit one Question · Stacks and queues
- Recursion on long chains Quick fact · Linked lists
- Remove repeated readings from a sorted log in place Question · Two pointers
- Repaint the connected region of a picture Question · Graphs
- Rolling hashes for pattern search Question · Strings and tries
- Routes across a grid with blocked cells Question · Dynamic programming
- Rubric areas Quick fact · Interview craft
- Same-direction vs opposite-end pointers Question · Two pointers
- Saving memory with rolling rows Question · Dynamic programming
- Seat guests at two tables with no feud at either Question · Graphs
- Shift a playlist k places to the right, in place Question · Arrays, strings and hash maps
- Shortest run of orders that reaches a goal Question · Sliding window
- Slicing copies Quick fact · Two pointers
- Slowest reading pace that still finishes on time Question · Searching sorted data
- Smallest truck that delivers every parcel in d days Question · Searching sorted data
- Smallest value in a rotated sorted list Question · Searching sorted data
- Smash the two heaviest rocks until one is left Question · Heaps and priority queues
- Sort a tray of three token colours in one pass Question · Two pointers
- Sort intervals by start or by end? Question · Greedy choices and intervals
- sorted() cost Quick fact · Complexity analysis
- sorted() vs list.sort() Quick fact · Two pointers
- Sorting tuples Quick fact · Greedy choices and intervals
- Space complexity and the call stack Question · Complexity analysis
- Split items into two piles of equal weight Question · Dynamic programming
- Spot the first repeated badge at the door Question · Arrays, strings and hash maps
- Spotting the pattern from the question Question · Interview craft
- Squared deviations in sorted order Question · Two pointers
- Stack or queue: LIFO and FIFO Question · Stacks and queues
- str is immutable Quick fact · Complexity analysis
- str.find and in Quick fact · Strings and tries
- str.join Quick fact · Strings and tries
- str.startswith with a tuple Quick fact · Strings and tries
- Strings are immutable Quick fact · Strings and tries
- Sum two numbers stored digit by digit Question · Linked lists
- Swap every node's left and right children Question · Trees
- Swapping in Python Quick fact · Two pointers
- Sweep-line thinking Question · Greedy choices and intervals
- sys.setrecursionlimit Quick fact · Backtracking
- Talking while you code Question · Interview craft
- Testing your own code in an interview Question · Interview craft
- The backtracking template: choose, explore, undo Question · Backtracking
- The cost of building strings Question · Complexity analysis
- The cost table for common data structures Question · Complexity analysis
- The earliest valid task order Question · Graphs
- The first five minutes of a coding interview Question · Interview craft
- The k depots nearest the warehouse Question · Heaps and priority queues
- The k-th biggest reading Question · Heaps and priority queues
- The k-th smallest value in a search tree Question · Trees
- The monotonic stack pattern Question · Stacks and queues
- The one value without a partner Question · Bits and maths
- The placeholder head trick Question · Linked lists
- Three-argument pow Quick fact · Bits and maths
- Tidy a file path with . and .. parts Question · Stacks and queues
- Top three suggestions as you type Question · Strings and tries
- Top-down caching or bottom-up tables? Question · Dynamic programming
- Trace a word through a letter grid Question · Backtracking
- Trie or hash set? Question · Strings and tries
- Tuples as heap keys Quick fact · Heaps and priority queues
- Turn a chain of links around Question · Linked lists
- Two gift prices that hit the budget exactly Question · Arrays, strings and hash maps
- Union-find cost Quick fact · Graphs
- Union-find: how it works and when to reach for it Question · Graphs
- Using bisect and sorted lists in practice Question · Searching sorted data
- Ways to cross n stepping stones, one or two at a time Question · Dynamic programming
- Ways to read a digit string as letters (1 = A … 26 = Z) Question · Dynamic programming
- Weave two sorted chains into one Question · Linked lists
- What common Python operations cost Question · Complexity analysis
- What makes a good dictionary key Question · Arrays, strings and hash maps
- What Python string operations cost Question · Strings and tries
- What to do when you are stuck Question · Interview craft
- What you see from the right of a tree Question · Trees
- When a chain beats a Python list Question · Linked lists
- When a sliding window does not work Question · Sliding window
- When do two pointers work, and why? Question · Two pointers
- When does a greedy choice work? Question · Greedy choices and intervals
- Where does a rearranged pattern appear in a text? Question · Sliding window
- Where O(log n) comes from Question · Complexity analysis
- Where to start a delivery loop so the van never runs dry Question · Greedy choices and intervals
- Where would a new price go in a sorted list? Question · Searching sorted data
- Which cable closes a loop? Question · Graphs
- Which complexity fits which input size Question · Complexity analysis
- Which ticket from 0 to n is absent? Question · Bits and maths
- Whole-number square root without math.sqrt Question · Searching sorted data
- Why a window with a nested loop is still O(n) Question · Sliding window
- Why appending to a list is amortized O(1) Question · Arrays, strings and hash maps
- Why Dijkstra fails with negative weights Question · Graphs
- Why search trees need to stay balanced Question · Trees
- Working modulo 10⁹ + 7 Question · Bits and maths
- Working out the cost of recursion Question · Complexity analysis
- x in list cost Quick fact · Complexity analysis
- x in some_list Quick fact · Arrays, strings and hash maps