Several progressive tasks on a starter codebase in CoderPad with an AI assistant panel; usually two rounds
They grade
How you prompt, check and explain what the assistant writes
AI use
The first task usually without AI, later tasks with it
Questions Meta asks in this round 105
Grid maze solver with keys, doors and bombs, AI-assistedCodingYou get a small existing codebase that models a grid maze and an AI assistant you may use. Fix a bug in the provided code, then find the shortest path from start to exit, then add…
Last asked Sep 2026
Binary tree vertical order traversalCodingReturn a binary tree's values column by column, from the leftmost column to the rightmost. The root is in column 0, a left child one column to the left of its parent and a right…
Last asked Sep 2026
Choose words with no shared letters to cover the most lettersCodingGiven a list of lowercase words, pick a subset in which no letter appears twice across the chosen words, maximizing the number of distinct letters covered. Start with a correct…
Last asked Aug 2026
Binary tree right side viewCodingReturn the values visible when you look at a binary tree from the right: the last node of each level, top to bottom. Follow-ups: the left side view, and both views in a single…
Last asked Apr 2026
Top K frequent elementsCodingGiven an integer array and k, return the k values that occur most often, in any order; ties at the cutoff may go either way. One version asks for the most frequent request IDs in…
Last asked Feb 2026
Card game: pick cards that sum to 15CodingYou get a small existing codebase for a card game played with a 36-card deck, and you may use an AI assistant. The game revolves around picking cards whose values add up to 15…
Last asked Sep 2026
Friend recommendation by mutual friendsCodingRecommend friends ranked by number of mutual friends in a social graph. Reported on 1point3acres' Fireworks AI bank; reconstructed in our own words.
Last asked Sep 2026
Find a local minimum or peak with binary searchCodingFind any local minimum of an array, an element no larger than its neighbours (treat positions outside the array as infinitely large), in O(log n) time. The same idea finds a peak…
Last asked Aug 2026
Subarray sum equals kCodingCount the contiguous subarrays whose sum equals k; the array may contain negative numbers. Follow-ups: only report whether such a subarray exists, or return the longest one.
Last asked Aug 2026
Valid palindrome after deleting at most k charactersCodingReturn whether a string can become a palindrome by deleting at most k characters. Relate it to the longest palindromic subsequence and give the time and space of your solution.
Last asked Aug 2026
Diameter of a binary treeCodingReturn the number of edges on the longest path between any two nodes of a binary tree. The path need not pass through the root. Solve it in one pass.
Last asked May 2026
Nested list weight sumCodingA nested list holds integers and other nested lists. Return the sum of every integer multiplied by its depth (integers in the outer list have depth 1).
Last asked Feb 2026
Basic calculator IICodingEvaluate a string expression of non-negative integers with +, -, , / and spaces, no parentheses, respecting precedence (integer division truncates toward zero). Variants reported:…
Last asked Oct 2025
Random pick with weightCodingGiven positive weights, implement pick() that returns index i with probability wi / sum(w). Build prefix sums once, then binary search a random number into them. One version gives…
Last asked Oct 2025
Range sum of a binary search treeCodingGiven a binary search tree and two bounds low and high, return the sum of the values within the inclusive range, skipping subtrees that cannot contain any. Follow-up: answer many…
Last asked Sep 2026
Resolve a cd command to an absolute pathCodingWrite a function that takes the current directory and the argument to cd, and returns the directory pwd would print afterwards. Handle ., .., repeated and trailing slashes, and…
Last asked Sep 2026
Two sumCodingGiven an integer array and a target, return the indices of the two different elements that add up to the target; exactly one such pair exists. Then solve it without a hash map…
Last asked Sep 2026
Sum root-to-leaf numbersCodingEach node of a binary tree holds a digit, so every root-to-leaf path spells a number. Return the sum of all those numbers.
Last asked Aug 2026
Cheapest round-trip flight from two price listsCodingdeparturei is the price of flying out on day i and arrivalj the price of flying back on day j. Return the cheapest total for a trip that returns after it departs, in one pass.
Last asked Jul 2026
Count palindromic substringsCodingCount the substrings of a string that are palindromes, counting each position separately. Expanding around every centre gives O(n^2) time and O(1) space.
Last asked May 2026
Longest increasing path in a matrixCodingReturn the length of the longest path in an integer matrix that moves up, down, left or right and only to strictly larger values. Use memoised DFS (or a topological order) so…
Last asked Apr 2026
Best time to buy and sell stockCodingGiven daily prices, return the most profit you can make. First allow any number of buy-then-sell transactions (holding one share at a time), then allow only one transaction.
Last asked Apr 2026
Merge two sorted interval listsCodingImplement mergetwointervallists(a, b). Each argument is a list of intervals start, end with integer endpoints and start <= end. Each list is sorted by start, and no two intervals…
Last asked Mar 2026
Diagonal traversal of a matrixCodingReturn the elements of a matrix diagonal by diagonal. In one version the direction alternates (up-right, then down-left); in another every diagonal is read in the same direction…
Last asked Feb 2026
Lowest common ancestor with parent pointersCodingEach tree node has a pointer to its parent, and you are given only the two nodes, not the root. Return their lowest common ancestor using O(1) extra space.
Last asked Feb 2026
LRU cacheCodingBuild a key-value cache with a fixed capacity that evicts the least recently used entry when it is full. get(key) returns the value or a miss, put(key, value) inserts or updates…
Find first and last position of an element in a sorted arrayCodingGiven an array of integers sorted in non-decreasing order and a target value, return the index of the first and the last occurrence of the target, or -1, -1 when it is absent. The…
Last asked Oct 2025
Check that each tree node equals its subtree's averageCodingFor a binary tree, decide whether every node's value equals the average of the values in its subtree (or of the nodes below it, as the interviewer defines it), or count the nodes…
Possibly retired
Cutting ribbonsCodingYou have pieces of wood (or ribbon) of given lengths and need k pieces of equal length; you may cut but not join. Return the longest length that still yields at least k pieces…
Possibly retired
Minimum window substringCodingGiven strings s and t, return the shortest substring of s that contains every character of t, counting repeats, or an empty string if there is none. Grow the window until it…
Possibly retired
Missing rangesCodingGiven a sorted list of distinct integers inside a fixed range (for example 0 to 99), list the gaps. In the reported variant a gap of up to three numbers is written out number by…
Possibly retired
Car poolingCodingA vehicle with a given capacity drives in one direction. Each trip is passengers, start, end. Return whether all trips fit without ever exceeding capacity, by sorting pickup and…
Possibly retired
Count active follow connections in SQLCodingA table records follow and unfollow events between users over time. Write SQL that returns the current number of active follow connections, taking each pair's latest event into…
Possibly retired
Nth node from the end of a linked listCodingReturn (or remove) the n-th node from the end of a singly linked list in one pass, moving a lead pointer n steps ahead of a trailing one.
Possibly retired
Recommend accounts your followees followCodingGiven a dictionary from each user to the people they follow, for example {A: B, C, B: C, D, C: E}, return for a user every account followed by the people they follow that they…
Possibly retired
Closest binary search tree valueCodingGiven a binary search tree and a target number (possibly fractional), return the value in the tree closest to it, walking down one path from the root.
Possibly retired
Target indices after sorting an arrayCodingReturn the indices at which a target would sit once the array is sorted. In the reported version the array is already sorted and the answer must take logarithmic time: binary…
Possibly retired
Group dependent tasks into parallel levelsCodingYou run a build system. Each task has a unique, non-empty lowercase name. Some tasks depend on others: a dependency before, after means before must finish before after can start…
Last asked Aug 2026
Is there an island of exactly size k?CodingGiven a grid of land and water, answer many queries of the form "is there an island of exactly k cells?". Find the islands once, then answer each query quickly, and discuss what…
Last asked Aug 2026
Minimum root-to-leaf path sumCodingGiven the root of a binary tree whose nodes hold integers (values may be negative), find the root-to-leaf path with the smallest sum. A leaf is a node with no children. A…
Last asked Aug 2026
Find noisy annotators and retrain a classifier without themCodingA classifier is trained on labels from several human annotators, and some of them label carelessly. Find which annotators are unreliable, drop their labels, retrain, and show…
Last asked Jun 2026
Remove duplicates from a sorted array in placeCodingRemove duplicates from a sorted array in place so each value appears once, and return the new length; the first part of the array must hold the unique values in order. Use O(1)…
Last asked Apr 2026
Valid numberCodingReturn whether a string is a valid number: an integer or decimal with an optional sign, optionally followed by an exponent (e or E and an integer). Spell out the rules first, then…
Last asked Apr 2026
Construct a BST from its preorder traversalCodingGiven the preorder traversal of a binary search tree with distinct values, rebuild the tree and return its root. Aim for linear time.
Last asked Mar 2026
Spiral matrixCodingReturn all elements of an m x n matrix in spiral order: along the top row, down the right column, back along the bottom row, up the left column, then inward.
Last asked Mar 2026
Count distinct values in a sorted arrayCodingCount the distinct values in a sorted array of length n that holds only k distinct values, where k is much smaller than n. A linear scan works; do better by jumping over each run…
Last asked Mar 2026
Insert, delete and get random in O(1)CodingDesign a set with insert(val), remove(val) and getrandom(), each in average O(1) time. getrandom returns each current element with equal probability.
Last asked Mar 2026
Check whether a binary tree is completeCodingReturn whether a binary tree is complete: every level is full except possibly the last, and the last level's nodes are as far left as possible.
Last asked Feb 2026
Next permutationCodingRearrange an array of numbers into the next permutation in lexicographic order, in place with constant extra memory; if it is the last permutation, wrap around to the smallest.
Last asked Feb 2026
Shortest unique abbreviation for every wordCodingAbbreviate each word in a list of distinct words as a prefix, the count of the letters in between, and the last letter (like becomes l2e). When two words share an abbreviation…
Last asked Feb 2026
Binary search tree iteratorCodingImplement an iterator over a binary search tree that returns the values in ascending order with next() and hasnext(). Each call should take amortised O(1) time, and memory should…
Last asked Jan 2026
Build a text summarization API serviceCodingWith an AI assistant available, build a small production-style web service with FastAPI: POST /summarize takes JSON {"text": ...} and returns {"summary": ...}. Add input…
Last asked Jan 2026
Minimum add to make parentheses validCodingReturn the fewest parentheses to insert so a string of ( and ) becomes balanced, counting unmatched openers and closers in one pass.
Last asked Jan 2026
Implement an LRU cacheCodingImplement a least-recently-used cache with get(key) and put(key, value), both in O(1) time, with a fixed capacity.
Add two binary stringsCodingGiven two binary numbers as strings, return their sum as a binary string, adding digit by digit from the right with a carry, without converting to integers.
Last asked Jan 2026
Build a binary tree from a parenthesized stringCodingA string encodes a binary tree as an integer followed by zero, one or two parenthesized subtrees, the left one first, for example 4(2(3)(1))(6(5)). Parse it into a tree and return…
Last asked Jan 2026
Repeatedly remove runs of equal adjacent charactersCodingRemove every run of two or more equal adjacent characters, and keep doing it as new runs form, until none remain. For example xyyyx becomes xx and then the empty string. Do it in…
Last asked Jan 2026
Insert into a sorted circular linked listCodingYou are given a node somewhere in a circular linked list sorted in ascending order. Insert a value so the list stays sorted and return a node of the list. Handle an empty list, a…
Last asked Dec 2025
Minimum time to finish target courses in a prerequisite DAGCodingCourses form a directed acyclic graph of prerequisites and each course takes a given time; any number of courses can run at once as soon as their prerequisites are done. Return…
Last asked Dec 2025
Word breakCodingReturn whether a string can be split into a sequence of words from a dictionary, where words may be reused. Give the dynamic programming solution and its cost.
Last asked Dec 2025
Four short array and string exercisesCodingFour quick problems in one round: 1. Return the difference between the number of uppercase and lowercase letters in a string. 2. Repeatedly subtract from the non-zero elements of…
Last asked Dec 2025
All root-to-leaf path sumsCodingReturn a list with the sum of the values along every root-to-leaf path of a binary tree, one entry per leaf, in left-to-right order.
Last asked Dec 2025
Convert an integer to hexadecimalCodingConvert a 32-bit signed integer to a lowercase hexadecimal string without library conversion functions. Negative numbers use two's complement, and the result has no leading zeros…
Last asked Dec 2025
Insert plus or minus signs between digits to reach a targetCodingGiven a string of digits and a target, insert +, - or nothing between consecutive digits so the expression equals the target, and return every such expression. Handle numbers with…
Last asked Dec 2025
Making a large islandCodingIn a binary grid you may change at most one water cell to land. Return the size of the largest island you can end up with. Label each island and its size once, then try each water…
Last asked Dec 2025
Shortest distance from all buildingsCodingA grid has empty land, buildings and obstacles. Find the empty cell whose total walking distance to every building is smallest (moving up, down, left or right), or return -1 if no…
Last asked Dec 2025
Check completeness of a binary treeCodingGiven the root of a binary tree, return whether it is complete: every level is full except possibly the last, and the nodes on the last level sit as far left as possible. Explain…
Last asked Dec 2025
Car rental utilization by city (SQL)CodingGiven tables of rental cars and their rentals, write SQL that reports utilization per city: how much of the available fleet time in each city was actually rented over a period…
Last asked Dec 2025
Longest palindromic substringCodingReturn the longest substring of a string that reads the same forwards and backwards. Start with expanding around each center, state the time and space, and say how you would get…
Last asked Nov 2025
Thread-safe job registry with expiryCodingBuild an in-memory registry of jobs that many threads read and write at once. Each job is registered with a time to live; lookups must not return a job whose time has passed, and…
Last asked Nov 2025
Shortest subarray whose max minus min is at least KCodingGiven an integer array and k, return the length of the shortest contiguous subarray in which the largest value minus the smallest value is at least k, or -1 if none exists. Aim…
Last asked Oct 2025
Shortest substring with N distinct charactersCodingGiven a string and a number n, return the shortest substring that contains n distinct letters (or say that none exists). Use a sliding window that grows until it holds n distinct…
Last asked Oct 2025
Count the words in a documentCodingGiven the text of a document, return how many words it contains. The real work is the definition: agree with the interviewer what counts as a word (is "it's" one word or two, what…
Possibly retired
Counter class with add, count and removeCodingWrite a class that stores strings with how many times each was added. Support add(s), count(s) and remove(s). Follow-ups: return the total count across everything stored, and how…
Possibly retired
Course schedule: detect a cycle and return an orderCodingCourses have prerequisites. Decide whether all courses can be finished (the prerequisite graph has no cycle), and if so return a valid order to take them. Use depth-first search…
Possibly retired
Find K pairs with the smallest sumsCodingGiven two sorted arrays and k, return the k pairs (one number from each array) with the smallest sums. Start a min-heap with pairs formed from the first elements and push the next…
Possibly retired
Kth smallest element in a sorted matrixCodingEvery row and every column of an n x n matrix is sorted ascending. Return the k-th smallest value. Compare a min-heap over the rows with binary search on the value range.
Possibly retired
Permutations of a list with duplicatesCodingReturn every distinct ordering of a list that may contain repeated values, with no duplicate orderings in the output. Sort first and skip a value at a position when an equal value…
Possibly retired
Shortest path in an unweighted graph: BFS versus DFSCodingExplain how to find the shortest path between two nodes of an unweighted graph and its time complexity, without necessarily writing code. Then compare: why breadth-first search…
Possibly retired
Top k largest elementsCodingGiven an integer array nums and an integer k, return the k largest elements of nums. You may return them in any order. The result is a multiset. If a value appears several times…
Possibly retired
Scaled dot-product attention from scratchCodingWrite scaled dot-product attention by hand: from queries, keys and values, compute the scores, scale them by the square root of the key size, apply an optional mask, take a…
Possibly retired
Carpool ride metrics in SQLCodingFor a ride-sharing product that lets riders share a car, write SQL over ride and request tables for a series of metrics, such as completed shared rides per day and averages per…
Possibly retired
Robot room cleanerCodingA cleaning robot is placed in an unknown room with obstacles. Using only move(), turnLeft(), turnRight() and clean(), clean every reachable cell. Explore by depth-first search…
Possibly retired
Cumulative user metrics with a full outer joinCodingMaintain a cumulative table of per-user metrics day by day: combine yesterday's cumulative snapshot with today's activity using a full outer join, so users with no activity today…
Possibly retired
Top three items per category in SQLCodingFor content in many categories, return the top three items in each category by an engagement measure, handling ties deliberately. Use a ranking window function partitioned by…
Possibly retired
Meeting rooms IICodingGiven meeting start and end times, return the fewest rooms needed so no two overlapping meetings share a room, with a min-heap of end times or by sweeping sorted starts and ends.
Possibly retired
Check whether a binary tree is a max-heapCodingDecide whether a binary tree is a valid max-heap: it must be complete (checked level by level) and every node must be at least as large as its children.
Possibly retired
Same-value region from a start pixel, and its borderCodingAn image is a grid of 0s and 1s. From a starting pixel, find every connected pixel with the same value. Follow-up: return the region's border, the neighbouring pixels that are not…
Possibly retired
Maximum swapCodingGiven a non-negative integer, swap two of its digits at most once to make the largest number possible. Record the last position of each digit, then find the first digit that has a…
Possibly retired
Best single location on a line to minimize total distanceCodingYou are choosing one location on a number line to serve a set of sites. You are given a non-empty integer array nums. Each value is the coordinate of a site (values may repeat and…
Bracket the first matching substring in each wordCodingImplement wrapsubstrings(s: str, elements: liststr) - str. s is a sentence of words separated by single spaces. elements is a list of strings. For each word in s, find the first…
Compress an n-ary tree by promoting childrenCodingEach node of an n-ary tree holds a unique integer value and an ordered list of children. You are given the root and a list compressednodes of values. Implement compress(root…
Count distinct values in every sliding windowCodingGiven an integer array nums and a window size k, return a list with one entry per contiguous window of length k (there are len(nums) - k + 1 of them). Each entry is the number of…
Fewest coins that cover every amount up to a limitCodingYou are given a list of coin denominations (positive integers) and an integer maxamount. You may take any number of coins of each denomination. Choose a multiset of coins so that…
Find bottleneck dependencies in a parallel buildCodingYou are given n build targets numbered 0 to n - 1 and a list of directed edges edges. An edge u, v means target v cannot start building until target u has finished. The graph has…
In-memory SQL table with filtering and multi-key sortingCodingBuild a small in-memory SQL-like database. You do not need to parse SQL text. Queries arrive as structured arguments. Implement SQLManager: - createtable(name: str, columns:…
Longest palindrome from equal-length wordsCodingYou are given a list of words. Every word has the same length k and uses lowercase letters. The list can contain duplicates. Pick some of the words (possibly none) and join them…
Match words against a letter patternCodingGiven a pattern string and a list of words, decide for each word whether it follows the pattern. A word follows the pattern when it has the same length as the pattern and the…
Median of a large unsorted array in linear timeCodingYou are given a very large, unsorted list of integers nums. Return its median. - If len(nums) is odd, the median is the middle value once the list is sorted. - If len(nums) is…
Multi-tap keypad: every string a press sequence can spellCodingAn old phone types letters by multi-tap: pressing a key once gives its first letter, twice in a row gives its second letter, and so on. Use this keypad: Key Letters ------ 1 A B C…
Remove parentheses from a plus/minus expressionCodingWrite a function simplify(expr: str) - str that removes every parenthesis from an expression and gives each term the sign it really has. Input. A valid expression made of: -…
Shortest equal length for two boards covering every holeCodingA table top has holes at integer positions along a single line, given as an unsorted array holes (positions may repeat or be negative). You will patch it with exactly two boards…
Split an array into two halves with equal sumsCodingYou are given an array nums of positive integers. Find an index i that splits it into two non-empty contiguous parts with the same sum: - the left part is nums0..i (it includes…
Question types
Meta AI-enabled coding interview: questions and format