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.
- Math565
- Greedy401
- A* Search6
- Array1842
- String778
- Hash Table749
- Dynamic Programming534
- Sorting483
- Depth-First Search338
- Binary Search305
- Matrix267
- Breadth-First Search261
Algorithms & Data Structures · Arbitrary-precision rounding — floats need not apply.
Assign Pins to Shortest Columns
Algorithms & Data Structures · The masonry-layout greedy: shortest column wins, leftmost on ties.
Algorithms & Data Structures · Meet new group sizes while disrupting as few buckets as possible.
Maximize Boxes Stored Through One Entrance
Algorithms & Data Structures · Prefix-min ceilings plus an exchange-argument greedy.
Algorithms & Data Structures · Net the balances, then match debtors to creditors greedily.
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.
Algorithms & Data Structures · Greedy word wrap inside ASCII borders — never split a word, never start a line with punctuation.
Algorithms & Data Structures · One DFS from the base unit multiplies factors down the tree, modulo a prime.
Nth Node at Level L in a 0/1 Tree
Algorithms & Data Structures · Never build the tree — halve recursively, or read the answer off the parity of popcount(n − 1).
Algorithms & Data Structures · One pass and O(k) memory: item i replaces a random slot with probability k/(i+1).
Algorithms & Data Structures · Three guarded divisions — and 0 wherever a denominator is 0.
Algorithms & Data Structures · One pass with a stack of signed terms; the trap is integer division truncating toward zero.
Parse an Integer Without parseInt
Algorithms & Data Structures · Sign, then digits through a lookup table, accumulating n * 10 + d — and NaN for anything else.
Algorithms & Data Structures · Split, round each value with string arithmetic, join — floats need not apply.
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 · One formula for every dimension: the square root of the summed squared differences.
Shortest Path on a Huge Map with A*
Algorithms & Data Structures · BFS's answer, found by expanding cells in order of cost-so-far plus an admissible estimate.
Algorithms & Data Structures · The farthest-reach greedy again, remembering which clip won each round.
Algorithms & Data Structures · Convert through the base unit — and divide with a modular inverse, since you can't divide mod p.
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 · Discount each graded relevance by log2(position + 2), then divide by the ideal ordering's DCG.
Algorithms & Data Structures · Observed agreement corrected for the agreement two annotators would reach by chance.
Algorithms & Data Structures · 1 − C(n − c, k) / C(n, k), computed as a running product so nothing overflows.
Algorithms & Data Structures · Binary long multiplication: add the doubled multiple for every set bit — and double with +=, not a 32-bit shift.
Algorithms & Data Structures · Each position multiplies its two successors, wrapping around the end with modular indices.
Algorithms & Data Structures · A base case at n <= 0 and one recursive call — then say where the call stack runs out.
Algorithms & Data Structures · Binary-search the root in [0, max(1, x)] for a fixed number of rounds — an epsilon loop never ends for large x.
Algorithms & Data Structures · An infinite generator over two BigInts — ordinary numbers lose precision past the 78th term.
Algorithms & Data Structures · Each sentence wraps at its own width; one box pads every line to the widest.
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 · 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 · Meeting rooms with stations: a bus is reusable only where it arrived, so keep the idle buses per station.
Pick the Query Type That Maximises Revenue
Algorithms & Data Structures · Committing to one type, you run it floor(k / duration) times; score every type and keep the best, earliest on ties.
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 · One cut per root branch that is too deep, placed at the deepest node above all of that branch's offending nodes.
Algorithms & Data Structures · One person, every cake: scan the grid once keeping the cake with the smallest Manhattan distance.
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 · 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.
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.
When Do the Chasing Points Meet?
Algorithms & Data Structures · N points in a cycle each move at unit speed toward the next one; simulate with a step small enough that the meeting time is right to the hundredth.
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.
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.
Count Alternating-Parity Subarrays
Algorithms & Data Structures · Count the subarrays in which neighbours always differ in parity: the number ending at each index is the length of the current alternating streak.
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.
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.
Asked on LeetCode
859 questions tagged A* Search or Math or Greedy · all time
- Insert Delete GetRandom O(1)mediumArrayHash TableMathDesign+124 companies
- Meeting Rooms IImediumArrayTwo PointersGreedySorting+224 companies
- Basic Calculator IImediumMathStringStack19 companies
- Add Two NumbersmediumLinked ListMathRecursion18 companies
- Basic CalculatorhardMathStringStackRecursion17 companies
- Rotate ImagemediumArrayMathMatrix17 companies
- Random Pick with WeightmediumArrayMathBinary SearchPrefix Sum+116 companies
- Climbing StairseasyMathDynamic ProgrammingMemoization16 companies
- Task SchedulermediumArrayHash TableGreedySorting+216 companies
- Container With Most WatermediumArrayTwo PointersGreedy16 companies
- Integer to RomanmediumHash TableMathString15 companies
- Best Time to Buy and Sell Stock IImediumArrayDynamic ProgrammingGreedy14 companies
- Roman to IntegereasyHash TableMathString14 companies
- Sqrt(x)easyMathBinary SearchNewton's Method14 companies
- Integer to English WordshardMathStringRecursion13 companies
- Valid Palindrome IIeasyTwo PointersStringGreedy13 companies
- Reorganize StringmediumHash TableStringGreedySorting+213 companies
- Non-overlapping IntervalsmediumArrayDynamic ProgrammingGreedySorting13 companies
- Pow(x, n)mediumMathRecursion13 companies
- Jump GamemediumArrayDynamic ProgrammingGreedy13 companies
- Jump Game IImediumArrayDynamic ProgrammingGreedy13 companies
- Unique PathsmediumMathDynamic ProgrammingCombinatorics13 companies
- Evaluate Reverse Polish NotationmediumArrayMathStack12 companies
- Gas StationmediumArrayGreedy12 companies
- Happy NumbereasyHash TableMathTwo PointersFloyd's Cycle Finding Algorithm12 companies
- K Closest Points to OriginmediumArrayMathDivide and ConquerGeometry+412 companies
- Max Points on a LinehardArrayHash TableMathGeometry+212 companies
- Valid Parenthesis StringmediumStringDynamic ProgrammingStackGreedy+112 companies
- Multiply StringsmediumMathStringSimulation11 companies
- Wildcard MatchinghardStringDynamic ProgrammingGreedyRecursion11 companies
- Remove K DigitsmediumStringStackGreedyMonotonic Stack10 companies
- Minimum Number of Taps to Open to Water a GardenhardArrayDynamic ProgrammingGreedy10 companies
- Insert Delete GetRandom O(1) - Duplicates allowedhardArrayHash TableMathDesign+110 companies
- Fizz BuzzeasyMathStringSimulation10 companies
- CandyhardArrayGreedy10 companies
- Split Array Largest SumhardArrayBinary SearchDynamic ProgrammingGreedy+110 companies
- Minimum Knight MovesmediumBreadth-First SearchHeuristic SearchBidirectional SearchA* Search10 companies
- Maximum Number of Events That Can Be AttendedmediumArrayGreedySortingHeap (Priority Queue)10 companies
- Count PrimesmediumArrayMathEnumerationNumber Theory+310 companies
- Missing NumbereasyArrayHash TableMathBinary Search+210 companies
- Best Meeting PointhardArrayMathSortingMatrix9 companies
- Power of TwoeasyMathBit ManipulationRecursion9 companies
- Reverse IntegermediumMath9 companies
- Can Place FlowerseasyArrayGreedy9 companies
- Maximum Product of Three NumberseasyArrayMathSorting9 companies
- Basic Calculator IIIhardMathStringStackRecursion9 companies
- Largest NumbermediumArrayStringGreedySorting9 companies
- Add StringseasyMathStringSimulation9 companies
- Robot Bounded In CirclemediumMathStringSimulation9 companies
- Frequency of the Most Frequent ElementmediumArrayBinary SearchGreedySliding Window+28 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.