call(back)

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.

Max Width

Algorithms & Data Structures · Greedy line packing and fiddly space math — full text justification.

hardSign in to star problems

Round Numeric Strings I

Algorithms & Data Structures · Arbitrary-precision rounding — floats need not apply.

mediumSign in to star problems

Nested Set Equality

Algorithms & Data Structures · Order and duplicates vanish at every depth — canonicalize.

mediumSign in to star problems

Chunked Stream Reader I

Algorithms & Data Structures · Reassemble lines from arbitrary chunks, reading lazily.

hardSign in to star problems

Experiment Buckets II

Algorithms & Data Structures · Interval sweep for the free ranges — independent of bucket-space size.

mediumSign in to star problems

Cross-Reference Logs to Flag Spam Numbers

Algorithms & Data Structures · A hash join across two logs — and saying that word out loud.

mediumSign in to star problems

Decide Target via Subsequence Plus/Multiply Expression

Algorithms & Data Structures · Expression search with precedence — the (total, pending product) trick.

hardSign in to star problems

Maximize Boxes Stored Through One Entrance

Algorithms & Data Structures · Prefix-min ceilings plus an exchange-argument greedy.

mediumSign in to star problems

Settle Debts I

Algorithms & Data Structures · Net the balances, then match debtors to creditors greedily.

mediumSign in to star problems

Restaurant Seating: Free Intervals

Algorithms & Data Structures · A +ppl/−ppl sweep; occupancy is constant between events.

mediumSign in to star problems

Count Pins on a Two-Column Screen

Algorithms & Data Structures · Only n scroll offsets matter — slide the window to a pin's top.

mediumSign in to star problems

Prefix Search I

Algorithms & Data Structures · lower_bound on the prefix itself, then one startswith check.

easySign in to star problems

Stateful Search Autocomplete Session

Algorithms & Data Structures · A typing session over search counts: top three by frequency, then alphabetically.

hardSign in to star problems

Reverse Count-and-Say I

Algorithms & Data Structures · Parse (count, digit) pairs backward — adjacent runs must differ.

hardSign in to star problems

Team Photo I

Algorithms & Data Structures · Sort both teams, pair i-th against i-th, and try both orders.

easySign in to star problems

Largest Sensor Distance

Algorithms & Data Structures · The largest nearest-sensor gap — sort one side, binary search from the other.

mediumSign in to star problems

Surveillance Footage I

Algorithms & Data Structures · Interval greedy: extend coverage with the farthest-reaching clip that still connects.

mediumSign in to star problems

Brace Expansion I

Algorithms & Data Structures · Tokenize into groups of choices, then fold a cartesian product across them.

mediumSign in to star problems

Replace Without Built-ins

Algorithms & Data Structures · Two-pointer scans with no library calls — the point is proving you can.

easySign in to star problems

In-Memory File System

Algorithms & Data Structures · A tree of nodes keyed by path segment — the OOD-style prompt where the implementation is the test.

mediumSign in to star problems

Boxed Sentences I

Algorithms & Data Structures · Greedy word wrap inside ASCII borders — never split a word, never start a line with punctuation.

easySign in to star problems

URL Query-String Parser

Algorithms & Data Structures · Split first, decode second — the ordering that makes the encoded-ampersand case work.

easySign in to star problems

Review Token Tagging

Algorithms & Data Structures · Case-insensitive, longest match wins, original text preserved — a trie walk from every offset.

mediumSign in to star problems

FIFO Order Allocator

Algorithms & Data Structures · Consume the oldest stock first and say which lots an order drew from — an implementation prompt with tie-break rules.

mediumSign in to star problems

Access-Log Request Metrics

Algorithms & Data Structures · Parse, validate, count — and pick the right denominator for the failure rate.

mediumSign in to star problems

Memory-Bounded Ranked Ballot Counter

Algorithms & Data Structures · Millions of ballots, Borda scoring, and memory that stays O(candidates) — the constraint is the question.

mediumSign in to star problems

Top-N Frequent Log Lines

Algorithms & Data Structures · Bucket sort when the multiset fits, a size-N heap when it's a stream — say both.

mediumSign in to star problems

Synonym Groups

Algorithms & Data Structures · "Bidirectional and transitive" means connected components — union-find, keyed by the smallest word.

mediumSign in to star problems

Median of a Stream I

Algorithms & Data Structures · Two heaps — a max-heap for the lower half, a min-heap for the upper — rebalanced on every add.

hardSign in to star problems

Implement MapReduce

Algorithms & Data Structures · Map, combine, partition, sort, reduce — the three parts a groupby does not have are the whole grade.

mediumSign in to star problems

Basic Calculator II

Algorithms & Data Structures · One pass with a stack of signed terms; the trap is integer division truncating toward zero.

mediumSign in to star problems

Word Search on a Letter Grid

Algorithms & Data Structures · Build the trie first and say why: it prunes the DFS the moment a prefix does not exist.

hardSign in to star problems

Merge Overlapping Intervals

Algorithms & Data Structures · Sort, then sweep — the pattern behind a dozen calendar problems.

mediumSign in to star problems

Group Anagrams

Algorithms & Data Structures · A 26-count key instead of sorting each word — the only decision in the problem.

easySign in to star problems

Word Ladder

Algorithms & Data Structures · BFS, not DFS — shortest path — then mention bidirectional BFS, which roughly square-roots the frontier.

hardSign in to star problems

First Duplicate Character I

Algorithms & Data Structures · The first character whose second occurrence comes earliest — one pass with a set, emoji included.

easySign in to star problems

Domain Operation Simulator

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.

mediumSign in to star problems

Parse an Integer Without parseInt

Algorithms & Data Structures · Sign, then digits through a lookup table, accumulating n * 10 + d — and NaN for anything else.

easySign in to star problems

Prefix Search II

Algorithms & Data Structures · Matches are contiguous: lower_bound the prefix, then the prefix bumped by one.

mediumSign in to star problems

Reverse Count-and-Say II

Algorithms & Data Structures · The reverse parse, memoized on (index, previous digit) — count, don't build.

hardSign in to star problems

Round Numeric Strings II

Algorithms & Data Structures · Split, round each value with string arithmetic, join — floats need not apply.

mediumSign in to star problems

Chunked Stream Reader II

Algorithms & Data Structures · Reassemble the lines, net the balances, then search for the fewest transfers.

hardSign in to star problems

Team Photo II

Algorithms & Data Structures · Only faced pairs matter: greedily match the smaller team into the larger.

mediumSign in to star problems

Team Photo III

Algorithms & Data Structures · The greedy match, written into two rows with empty slots.

mediumSign in to star problems

Fewest Towers to Cover Every Crossing

Algorithms & Data Structures · Greedy: place each tower as far right as the leftmost uncovered crossing allows.

mediumSign in to star problems

Brace Expansion II

Algorithms & Data Structures · A three-line grammar turns nested braces into a tiny recursive-descent parser.

hardSign in to star problems

Run-Length Encode and Decode

Algorithms & Data Structures · Find the end of each run (or each number), emit, jump.

easySign in to star problems

String Compression in Place

Algorithms & Data Structures · A read pointer and a write pointer over the same array — write never passes read.

mediumSign in to star problems

Surveillance Footage II

Algorithms & Data Structures · The farthest-reach greedy again, remembering which clip won each round.

mediumSign in to star problems

Surveillance Footage III

Algorithms & Data Structures · Sweep sorted clips tracking the farthest end; a start past it opens a gap.

easySign in to star problems

Sessionize Events by Entity

Algorithms & Data Structures · Sort by (entity, time), then extend or open one session per entity in a single sweep.

mediumSign in to star problems

NDCG@k

Algorithms & Data Structures · Discount each graded relevance by log2(position + 2), then divide by the ideal ordering's DCG.

mediumSign in to star problems

Socket Reader I

Algorithms & Data Structures · Buffer bytes across recv calls, split on newlines, and decode only whole lines.

mediumSign in to star problems

First Duplicate Character II

Algorithms & Data Structures · Where the earliest second occurrence sits — the same set scan, returning an index.

easySign in to star problems

Count Each Character in First-Seen Order

Algorithms & Data Structures · One counting pass into a Map, emitted in insertion order: AAABBAA becomes 5A2B.

easySign in to star problems

Pour Water II

Algorithms & Data Structures · Levels from the top down, one character per column — ground, water, or air.

easySign in to star problems

Boxed Sentences II

Algorithms & Data Structures · Each sentence wraps at its own width; one box pads every line to the widest.

easySign in to star problems

SnowCal Interpreter

Algorithms & Data Structures · One register, a dictionary of recorded bodies, and a mode flag that says whether a line runs or is being stored.

mediumSign in to star problems

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.

mediumSign in to star problems

Reverse Each Alphanumeric Run

Algorithms & Data Structures · Two pointers per run: find where the run ends, reverse it in place, carry on from there.

easySign in to star problems

Grep With Context Lines

Algorithms & Data Structures · Turn each match into a clipped line range, merge ranges that touch, and print a separator between the groups left.

mediumSign in to star problems

JSON Parser

Algorithms & Data Structures · Recursive descent with one cursor: a value function that dispatches on the next character, and a parser per kind.

hardSign in to star problems

Document Store With Boolean Queries

Algorithms & Data Structures · An inverted index plus a tiny expression parser whose values are sets of document ids.

hardSign in to star problems

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.

easySign in to star problems

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.

mediumSign in to star problems

Sort Colours Through an API

Algorithms & Data Structures · Dutch national flag with three pointers, using only getColor and swap — one pass, no counting.

mediumSign in to star problems

Most Credits With at Most K Classes

Algorithms & Data Structures · Weighted interval scheduling with a count budget: sort by end, binary-search the compatible predecessor, add a dimension for the cap.

hardSign in to star problems

Minimum Bus Fleet

Algorithms & Data Structures · Meeting rooms with stations: a bus is reusable only where it arrived, so keep the idle buses per station.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

hardSign in to star problems

String-Command Calculator I

Algorithms & Data Structures · A recursive-descent parser: a command's operand is either an integer or a parenthesised sub-program evaluated from zero.

mediumSign in to star problems

Serialize a Dictionary Trie

Algorithms & Data Structures · Pre-order with explicit end-of-word marks and parentheses around children; parsing it back is a recursive descent.

mediumSign in to star problems

Merge Sort

Algorithms & Data Structures · Split in half, sort each half, merge with two indices — stable, O(n log n), and the merge is the whole interview.

mediumSign in to star problems

String-Command Calculator II

Algorithms & Data Structures · The commands become a prefix grammar: an expression is an integer or (OP expr expr), evaluated by recursive descent over the tokens.

mediumSign in to star problems

Longest Common Substring

Algorithms & Data Structures · A table that resets to zero on a mismatch, so the answer is the largest cell rather than the corner, and one row of it is enough.

mediumSign in to star problems

Filter Ads by a Single Rule

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.

easySign in to star problems

Assign Each Flight a Runway

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.

mediumSign in to star problems

Rank Vectors by Cosine Similarity

Algorithms & Data Structures · Score every candidate against the query, keep the indices with the scores, sort descending; the zero vector needs a defined answer.

easySign in to star problems

Name Frequency Count

Algorithms & Data Structures · Map each name to how many times it appears; the second warm-up of the data-science screen.

easySign in to star problems

Decrypt to Dictionary Words

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Shift Every Nth Consonant

Algorithms & Data Structures · Count consonants as you scan, advance every nth one to the next consonant with wrap-around, and keep its case.

easySign in to star problems

Top N Matches From a Constant-Time Score

Algorithms & Data Structures · P candidates, an O(1) score, N much smaller than P: a min-heap of size N beats sorting, in time and in space.

easySign in to star problems

Validated Add-Subtract Calculator

Algorithms & Data Structures · Evaluate digits joined by + and - only after proving the string is well formed: no stray characters, no leading zeros, no doubled operators, and everything inside 32 bits.

mediumSign in to star problems

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.

mediumSign in to star problems

Fish From Decaying Ponds

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.

mediumSign in to star problems

Docstring Naming Conversion

Algorithms & Data Structures · Inside backticks, snake_case identifiers become camelCase and UPPER_CASE constants stay; everything else, including every space, is copied through.

easySign in to star problems

Cyclic Number Pairs

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.

mediumSign in to star problems

Reverse Words, Keeping the Spacing

Algorithms & Data Structures · Reverse the order of the words while every run of spaces stays exactly where it was, including leading and trailing runs.

easySign in to star problems

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.

mediumSign in to star problems

Sort Each Border of a Matrix

Algorithms & Data Structures · For every concentric ring, collect the values clockwise from the ring's top-left corner, sort them, and write them back in the same order; single-row and single-column centres are the trap.

mediumSign in to star problems

Serialize a Key-Value Store

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.

mediumSign in to star problems

Asked on LeetCode

1,102 questions tagged Rolling Hash or Sorting or String · all time

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.