Problems
Callback's own problems and the LeetCode questions companies have been asking, in one place — pick a category, then filter by company, frequency, status, difficulty, topic, and language.
- Hash Table749
- Greedy401
- Breadth-First Search261
- Array1842
- String778
- Math565
- Dynamic Programming534
- Sorting483
- Depth-First Search338
- Binary Search305
- Matrix267
- Tree242
Algorithms & Data Structures · Streaming design: recent counts, top-k, and sliding-window bans.
Algorithms & Data Structures · Order and duplicates vanish at every depth — canonicalize.
Assign Pins to Shortest Columns
Algorithms & Data Structures · The masonry-layout greedy: shortest column wins, leftmost on ties.
Collect Pins from Reachable Boards
Algorithms & Data Structures · BFS over the bipartite pin-board graph without building board-to-board edges.
Algorithms & Data Structures · Advance players in O(1), rank them without sorting — a linked list per room.
Algorithms & Data Structures · Meet new group sizes while disrupting as few buckets as possible.
Algorithms & Data Structures · Smallest-free allocation under a capacity that moves at runtime.
Cross-Reference Logs to Flag Spam Numbers
Algorithms & Data Structures · A hash join across two logs — and saying that word out loud.
Sparse Matrix Storage, Addition, and Multiplication
Algorithms & Data Structures · Storage proportional to nonzeros — and the cancellation trap.
Compute Reachable Cells for a Cleaning Robot
Algorithms & Data Structures · Slide-until-blocked physics: rest positions are the states, not cells.
Maximize Boxes Stored Through One Entrance
Algorithms & Data Structures · Prefix-min ceilings plus an exchange-argument greedy.
Implement Single-Tab Browser History Navigation
Algorithms & Data Structures · A cursor over one visit stack: truncate forward history, clamp at both ends.
Algorithms & Data Structures · Net the balances, then match debtors to creditors greedily.
Algorithms & Data Structures · Two sorted indexes and a binary search you write by hand.
Algorithms & Data Structures · BFS over routes, not stops — clear each stop as you expand it.
Algorithms & Data Structures · Two out-edges per index: a graph search with a visited array.
Count Objects in a Pixel Grid via an API
Algorithms & Data Structures · Flood fill through an opaque API — isSameObject is the catch.
Algorithms & Data Structures · Open roads cost 0, closed cost 1 — textbook 0-1 BFS.
Stateful Search Autocomplete Session
Algorithms & Data Structures · A typing session over search counts: top three by frequency, then alphabetically.
Algorithms & Data Structures · Sort both teams, pair i-th against i-th, and try both orders.
Algorithms & Data Structures · Interval greedy: extend coverage with the farthest-reaching clip that still connects.
Shortest Path Around Obstacles
Algorithms & Data Structures · Unit steps on a grid: BFS, and the first arrival is the answer.
Algorithms & Data Structures · An undo log per open transaction: rollback replays it, commit hands it to the parent.
Algorithms & Data Structures · Injected transport, upserts keyed by id, a dirty set — a small class with senior signals.
Algorithms & Data Structures · A tree of nodes keyed by path segment — the OOD-style prompt where the implementation is the test.
Algorithms & Data Structures · Cycle detection dressed up as a scheduling question.
Algorithms & Data Structures · Greedy word wrap inside ASCII borders — never split a word, never start a line with punctuation.
Algorithms & Data Structures · Split first, decode second — the ordering that makes the encoded-ampersand case work.
Algorithms & Data Structures · Parse, validate, count — and pick the right denominator for the failure rate.
Memory-Bounded Ranked Ballot Counter
Algorithms & Data Structures · Millions of ballots, Borda scoring, and memory that stays O(candidates) — the constraint is the question.
Algorithms & Data Structures · Bucket sort when the multiset fits, a size-N heap when it's a stream — say both.
Algorithms & Data Structures · "Bidirectional and transitive" means connected components — union-find, keyed by the smallest word.
Algorithms & Data Structures · Flood fill from every unvisited land cell — and know when DFS, BFS or union-find fits.
Algorithms & Data Structures · Separate chaining with a resize at a load-factor threshold — fixed buckets aren't enough.
Algorithms & Data Structures · A heap cannot update a key — push the new entry and discard stale ones at pop time.
Algorithms & Data Structures · A queue of admitted timestamps per key: evict what aged out, admit while under the limit.
Algorithms & Data Structures · Map, combine, partition, sort, reduce — the three parts a groupby does not have are the whole grade.
Algorithms & Data Structures · Idempotent writes, a separate read model, and an audit log — all three in one small service.
Algorithms & Data Structures · A group dies exactly when it has no adjacent empty point — flood fill each neighbouring enemy group.
Implement a Robust REST Create Method
Algorithms & Data Structures · Authenticate, validate, sanitise — then make POST safe to retry with an Idempotency-Key scoped to the caller.
Algorithms & Data Structures · Hash map plus doubly linked list, all operations O(1).
Algorithms & Data Structures · One pass, three sets — and derive the box index out loud instead of asserting it.
Algorithms & Data Structures · Two-colour with BFS from every unvisited node; an odd cycle is the only way to fail.
Algorithms & Data Structures · A 26-count key instead of sorting each word — the only decision in the problem.
Algorithms & Data Structures · BFS, not DFS — shortest path — then mention bidirectional BFS, which roughly square-roots the frontier.
Algorithms & Data Structures · The first character whose second occurrence comes earliest — one pass with a set, emoji included.
Unique Values Across Two Arrays I
Algorithms & Data Structures · Every value once, in first-seen order — a Set keeps insertion order.
Algorithms & Data Structures · PUT, GET and a COUNT of everything under a domain: match on the label boundary, then make COUNT fast with a trie.
Algorithms & Data Structures · Rebuild the itinerary with Hierholzer's walk, then look for a repeat.
Algorithms & Data Structures · BFS from the start: the layer where the last index appears is the answer.
Algorithms & Data Structures · Reassemble the lines, net the balances, then search for the fewest transfers.
Algorithms & Data Structures · Only faced pairs matter: greedily match the smaller team into the larger.
Algorithms & Data Structures · The greedy match, written into two rows with empty slots.
Fewest Towers to Cover Every Crossing
Algorithms & Data Structures · Greedy: place each tower as far right as the leftmost uncovered crossing allows.
Algorithms & Data Structures · The farthest-reach greedy again, remembering which clip won each round.
Algorithms & Data Structures · Kahn's algorithm: peel sensors with no pending inputs; leftovers mean a cycle.
Algorithms & Data Structures · Sort by (entity, time), then extend or open one session per entity in a single sweep.
Algorithms & Data Structures · Store (tokens, last seen) per key and refill lazily on each call — O(1) per key.
Stratified Sampling with Largest-Remainder Allocation
Algorithms & Data Structures · Floor each proportional share, give leftovers to the largest remainders, sample within each stratum.
Algorithms & Data Structures · Observed agreement corrected for the agreement two annotators would reach by chance.
Algorithms & Data Structures · Where the earliest second occurrence sits — the same set scan, returning an index.
Unique Values Across Two Arrays II
Algorithms & Data Structures · Count every value across both arrays in a Map, then keep the ones counted exactly once.
Unique Values Across Two Arrays III
Algorithms & Data Structures · Objects compare by reference, so deduplicate on a property — the first object with each key wins.
Count Each Character in First-Seen Order
Algorithms & Data Structures · One counting pass into a Map, emitted in insertion order: AAABBAA becomes 5A2B.
Algorithms & Data Structures · Each sentence wraps at its own width; one box pads every line to the widest.
Algorithms & Data Structures · A rank histogram and two booleans name every category — the ace is the only edge case.
Nearest Bathroom for Every Desk
Algorithms & Data Structures · Seed the queue with every bathroom and expand once — one BFS for the whole floor, not one per desk.
Algorithms & Data Structures · Courses run in waves, and a wave takes as long as its slowest course.
Tree Height After Deletions II
Algorithms & Data Structures · Delete exactly the non-root nodes whose own subtree is k or more deep — one post-order pass, no DP.
Algorithms & Data Structures · BFS over an implicit graph, fetching each page exactly once.
Algorithms & Data Structures · Store one predecessor per page, not a path per queue entry, and walk it back from the target.
Algorithms & Data Structures · A BFS that keeps going after the target is gone — and the thread-safety story that comes with it.
Algorithms & Data Structures · Per-client (tokens, last seen), a tier config read on every call, and an explicit fallback for clients with no valid tier.
Algorithms & Data Structures · Timestamps arrive in order, so each type's list is already sorted and a count is two binary searches.
Algorithms & Data Structures · One register, a dictionary of recorded bodies, and a mode flag that says whether a line runs or is being stored.
Algorithms & Data Structures · A heap of entries with lazy deletion: a task added twice has two entries, and the stale one is skipped on the way out.
Key-Value Store With Prefix Scan
Algorithms & Data Structures · A hash map for the point operations and a sorted key list for the scan — agree the smallest version, then extend.
Document Store With Boolean Queries
Algorithms & Data Structures · An inverted index plus a tiny expression parser whose values are sets of document ids.
Top K Search Terms, One Vote per User
Algorithms & Data Structures · Dedupe (user, term) pairs before counting, then sort by count with the term as the tie-break.
Top K Selling Books After Each Sale
Algorithms & Data Structures · Totals in a map; the top K is recomputed from the map on each update, or kept in a bounded structure when K is small and the catalogue huge.
Algorithms & Data Structures · A deleted node hands its children to its nearest surviving ancestor, so it simply adds no level.
Algorithms & Data Structures · Meeting rooms with stations: a bus is reusable only where it arrived, so keep the idle buses per station.
Filter With a Dynamic Blacklist
Algorithms & Data Structures · Emitted items are final; held items wait in publish order and are re-checked whenever a word is unblocked.
Document Coverage: The Shortest Window
Algorithms & Data Structures · Minimum window over tokens: expand until every term is covered, shrink while it stays covered, keep the shortest.
Reach a Target With +2, Double and Halve
Algorithms & Data Structures · Any sequence counts, so think constructively: +2 keeps parity, doubling then +2s then halving shifts it, and halving is how you get smaller.
Algorithms & Data Structures · A failure is explained if something it depends on, transitively, failed first; the unexplained failures are the root causes.
Algorithms & Data Structures · A queue with an index pointer, a visited set marked on enqueue, neighbours in the order given.
Algorithms & Data Structures · Deleting a node takes its subtree: walk down from the root, never entering a deleted node, and keep the deepest level reached.
Algorithms & Data Structures · One cut per root branch that is too deep, placed at the deepest node above all of that branch's offending nodes.
Repeated Lookups in a Sorted Array
Algorithms & Data Structures · Many queries against one sorted array: record each value's first index once and answer every query from that, never searching twice.
Algorithms & Data Structures · Insertion-ordered tasks with a dependency set each: refuse an edge that would close a cycle, emit the earliest ready task, and copy both structures.
Algorithms & Data Structures · Kahn's algorithm with a min-heap in place of the queue: in-degrees, a frontier of ready nodes, and an empty result when a node never becomes ready.
Algorithms & Data Structures · Iterate the digit-square sum until a value repeats; the loop is the path from that value's first visit, and a happy number's loop is just [1].
Algorithms & Data Structures · One memo shared across every start: each value on a walk inherits the answer of where the walk stopped, so no value is followed twice.
Algorithms & Data Structures · Optional location, minimum-age and maximum-age constraints combined with AND or OR; an absent constraint is ignored, and no constraint matches everything.
Session Manager With Sliding Expiry
Algorithms & Data Structures · Unique tokens, validation that pushes the expiry forward, explicit revocation and an O(n) cleanup; an LRU cache with time as the key.
Algorithms & Data Structures · Runways are workers and flights are tasks: a heap of free times hands each flight, in start order, to the runway that frees up first.
Algorithms & Data Structures · Map each name to how many times it appears; the second warm-up of the data-science screen.
Algorithms & Data Structures · Create, list, delete and move resources in an in-memory tree: parent pointers for the upward checks, ordered child lists for the downward ones.
Algorithms & Data Structures · The Encrypt and Decrypt Strings variant the phone screen asks: return the dictionary words a ciphertext can decode to, not how many, by DFS with backtracking.
Transition Graph From Access Logs
Algorithms & Data Structures · Sort each user's accesses into a path from START to END, count transitions per source, and turn the counts into probabilities.
Longest Stable Transaction Period
Algorithms & Data Structures · The longest run of consecutive days whose total is divisible by k: prefix sums modulo k and the first index each remainder appeared.
Algorithms & Data Structures · Per-seller priority with FIFO ties, sellers taking turns in activation order, and VIP sellers taking up to two tasks per turn; the turn state has to survive between calls.
Algorithms & Data Structures · addTask, removeTask and a destructive popTask(num) in timestamp order: a heap with lazy deletion, and a version per task so stale heap entries are recognised.
Algorithms & Data Structures · The LRU follow-up: every entry carries a time-to-live, an expired entry is a miss, and expired entries must not take up capacity when something has to be evicted.
Order Validator With Rule Dependencies
Algorithms & Data Structures · Validation rules form a DAG: a rule is skipped when a prerequisite did not pass, a dependency that would close a cycle is refused, and removing a rule reconnects its prerequisites to its dependents.
Largest Number Below a Limit From Allowed Digits
Algorithms & Data Structures · Keep the limit's prefix as long as possible, step one digit down, then fill with the largest allowed digit; fall back to a shorter number, and mind leading zeros.
Subarray With the Largest Min Plus Max
Algorithms & Data Structures · It looks like a sliding-window problem and is not one: the best subarray of length two or more is always an adjacent pair.
Algorithms & Data Structures · Each hour fished lowers a pond's next yield by one. The heap greedy is the first answer; the accepted one finds the water line all ponds are fished down to and sums arithmetic series.
Algorithms & Data Structures · Count pairs of numbers that are digit rotations of each other: give every number a canonical rotation and count equal keys instead of comparing pairs.
Algorithms & Data Structures · Simulate alloc and erase over a bit array where blocks must start on an 8-cell boundary; the care is in ids, bounds and erasing something twice.
All Valid Expansions of Wildcard Parentheses
Algorithms & Data Structures · The follow-up to the wildcard validity check: enumerate every distinct balanced string the stars can produce, pruning on the running balance.
House Segments After Demolitions
Algorithms & Data Structures · Houses on a number line form segments of consecutive positions; each demolition changes the segment count by +1, 0 or -1 depending only on the two neighbours.
Count Path Sums in an N-ary Tree
Algorithms & Data Structures · Count downward paths that add up to a target when a node can have any number of children: a prefix-sum counter that is scoped to the current root-to-node path.
Equalize Root-to-Leaf Sums in an N-ary Tree
Algorithms & Data Structures · Raise node values by one at a time until every root-to-leaf path has the same sum, using the fewest increments: lift each shortfall as high in the tree as it can go.
Algorithms & Data Structures · Turn a map of arbitrary strings into one string and back. Any separator can appear in the data, so the format has to say where each field ends: length prefixes.
Algorithms & Data Structures · Number of Islands where the top edge touches the bottom and the left edge touches the right: wrap the neighbour arithmetic, then discuss union-find and cell flips.
Asked on LeetCode
1,173 questions tagged Breadth-First Search or Hash Table or Greedy · all time
- LRU CachemediumHash TableLinked ListDesignDoubly-Linked List47 companies
- Number of IslandsmediumArrayDepth-First SearchBreadth-First SearchUnion-Find+136 companies
- Two SumeasyArrayHash Table31 companies
- Group AnagramsmediumArrayHash TableStringSorting27 companies
- Longest Substring Without Repeating CharactersmediumHash TableStringSliding Window27 companies
- Time Based Key-Value StoremediumHash TableStringBinary SearchDesign26 companies
- Rotting OrangesmediumArrayBreadth-First SearchMatrix26 companies
- Course Schedule IImediumDepth-First SearchBreadth-First SearchGraph TheoryTopological Sort25 companies
- Top K Frequent ElementsmediumArrayHash TableDivide and ConquerSorting+425 companies
- Insert Delete GetRandom O(1)mediumArrayHash TableMathDesign+124 companies
- Meeting Rooms IImediumArrayTwo PointersGreedySorting+224 companies
- Course SchedulemediumDepth-First SearchBreadth-First SearchGraph TheoryTopological Sort+123 companies
- Word LadderhardHash TableStringBreadth-First SearchBidirectional Search22 companies
- Minimum Window SubstringhardHash TableStringSliding Window21 companies
- Longest Consecutive SequencemediumArrayHash TableUnion-Find20 companies
- LFU CachehardHash TableLinked ListDesignDoubly-Linked List19 companies
- Implement Trie (Prefix Tree)mediumHash TableStringDesignTrie17 companies
- Coin ChangemediumArrayDynamic ProgrammingBreadth-First SearchKnapsack Problem+117 companies
- Valid SudokumediumArrayHash TableMatrix16 companies
- Alien DictionaryhardArrayStringDepth-First SearchBreadth-First Search+316 companies
- Letter Combinations of a Phone NumbermediumHash TableStringBacktracking16 companies
- Subarray Sum Equals KmediumArrayHash TablePrefix Sum16 companies
- Task SchedulermediumArrayHash TableGreedySorting+216 companies
- Container With Most WatermediumArrayTwo PointersGreedy16 companies
- Design Memory AllocatormediumArrayHash TableDesignSimulation15 companies
- Evaluate DivisionmediumArrayStringDepth-First SearchBreadth-First Search+515 companies
- Top K Frequent WordsmediumArrayHash TableStringTrie+415 companies
- Integer to RomanmediumHash TableMathString15 companies
- Accounts MergemediumArrayHash TableStringDepth-First Search+315 companies
- Best Time to Buy and Sell Stock IImediumArrayDynamic ProgrammingGreedy14 companies
- Find the Length of the Longest Common PrefixmediumArrayHash TableStringTrie14 companies
- Roman to IntegereasyHash TableMathString14 companies
- Sudoku SolverhardArrayHash TableBacktrackingMatrix+214 companies
- Clone GraphmediumHash TableDepth-First SearchBreadth-First SearchGraph Theory14 companies
- Snapshot ArraymediumArrayHash TableBinary SearchDesign+114 companies
- Word BreakmediumArrayHash TableStringDynamic Programming+314 companies
- Word Break IIhardArrayHash TableStringDynamic Programming+314 companies
- Making A Large IslandhardArrayDepth-First SearchBreadth-First SearchUnion-Find+114 companies
- Serialize and Deserialize Binary TreehardStringTreeDepth-First SearchBreadth-First Search+214 companies
- Shortest BridgemediumArrayDepth-First SearchBreadth-First SearchMatrix13 companies
- Simple Bank SystemmediumArrayHash TableDesignSimulation13 companies
- Valid Palindrome IIeasyTwo PointersStringGreedy13 companies
- Design Tic-Tac-ToemediumArrayHash TableDesignMatrix+113 companies
- Reorganize StringmediumHash TableStringGreedySorting+213 companies
- Non-overlapping IntervalsmediumArrayDynamic ProgrammingGreedySorting13 companies
- Logger Rate LimitereasyHash TableDesignData Stream13 companies
- Shortest Path in Binary MatrixmediumArrayBreadth-First SearchMatrix13 companies
- Max Area of IslandmediumArrayDepth-First SearchBreadth-First SearchUnion-Find+113 companies
- Shortest Path in a Grid with Obstacles EliminationhardArrayBreadth-First SearchMatrix13 companies
- Valid AnagrameasyHash TableStringSorting13 companies
Listings only — titles, difficulty, and tags link out to LeetCode. Imported from the leetcode-company-wise-problems snapshot dated 1 June 2025. Frequency is that dataset's own relative score within a company and time range.