KatInterview

practice a little every day — you've got this ♡

Interview Practice Problems

Practice 5986 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.

5986
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 301–330 of 2219 results

  • Trees & GraphsMediumAuto-graded
    Lexicographically Smallest Valid Task Schedule

    Decide whether tasks with prerequisite constraints can all be run, and if so produce the lexicographically smallest valid run order, using topological sorting with a min-heap.

    Trees & Graphstopological-sortgraphheapcycle-detection
  • Dynamic ProgrammingMediumAuto-graded
    Booth Assignment Plan: Cheapest Non-Repeating Color Sequence

    Choose one of three colors per day to minimize total cost with no color on two adjacent days, then return the actual sequence using DP with backtracking.

    Dynamic Programmingdynamic-programmingpath-reconstructionarrays
  • Data Structure DesignMediumAuto-graded
    Seat Assignment with Forward-Only Probing on a Fixed Row

    Decide whether every request in a sequence can be seated in a fixed row when taken spots push it to the next free higher slot; tests efficient next-free-slot lookup, e.g. with union-find.

    Data Structure Designunion-findsimulationarraysgreedy
  • StringsEasyAuto-graded
    Screen Pasted Card Numbers: Format, Issuer Prefix and Luhn

    Filter strings by a character and length rule, an issuer-prefix range and the Luhn checksum, returning the original text of each valid entry in input order.

    Stringsstringsvalidationluhnsimulation
  • Trees & GraphsMediumAuto-graded
    Rank Suggested Connections by Shared Friends

    Build an undirected graph from friendship pairs, then rank every non-friend of a target user by mutual friends, degree and ID using a composite sort key.

    Trees & Graphsgraphadjacency-listsortingsets
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Earnings from Back-to-Back Booking Slots

    Pick non-overlapping time slots, where one may begin exactly as another finishes, to maximize total payout; tests weighted interval scheduling with sorting, DP and binary search.

    Dynamic Programmingdynamic-programmingbinary-searchintervalssorting
  • SQL & DataMediumAuto-graded
    Weekly Totals with 3-Week Rolling Sum in Pacific Time

    Bucket timestamped payments into Pacific-time Monday weeks, fill empty weeks with zero, and report weekly and trailing three-week totals.

    SQL & Datatime zonesdate bucketingrolling windowaggregation
  • Arrays & HashingEasyAuto-graded
    Compute Usage and Quality Metrics from Workplace Search Logs

    Aggregate a list of search log records into funnel, quality, latency and repeat-usage metrics, handling empty input and even-length medians.

    Arrays & Hashinghash-mapaggregationsimulationmedian
  • Trees & GraphsMediumAuto-graded
    Schedule Courses Under Prerequisite Rules

    Produce a deterministic course order that respects prerequisite pairs using a queue-based topological sort, or an empty list if the prerequisites contain a cycle.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignMediumAuto-graded
    Prioritized Delayed Job Queue Simulator

    Simulate a delayed job queue by replaying a log of schedule, reschedule, cancel and poll operations, returning each result in order while respecting priority and time ordering.

    Data Structure Designheaphash-mapsimulationlazy-deletion
  • Math & Bit ManipulationMediumAuto-graded
    Pair Growth by Adding One Coordinate to the Other

    Decide whether a positive integer pair can grow into a target pair by repeatedly adding one coordinate to the other, using reverse-step reasoning and Euclid-style reduction.

    Math & Bit Manipulationmatheuclidean-algorithmreverse-simulationnumber-theory
  • Data Structure DesignMediumAuto-graded
    Track and Analyze Obstacle Course Runs

    Simulate obstacle course data structures, track per-stage times, calculate target metrics, and run Monte Carlo probability estimation.

    Data Structure Designdesign-dsarraysstatistics
  • Arrays & HashingEasyAuto-graded
    95% Z-Interval for a Mean with Known Standard Deviation

    Compute a 95% z-based confidence interval for a population mean from a sample mean, known population standard deviation, and sample size, using the standard error.

    Arrays & Hashingconfidence-intervalcentral-limit-theoremstandard-errora-b-testing
  • Heaps, Sorting & SearchMediumAuto-graded
    Build a Max-Heap In Place with Bottom-Up Sifting

    Convert an integer list into a max-heap layout using the bottom-up sift-down procedure, matching an exact output array including tie-break behavior.

    Heaps, Sorting & Searchheaparraysift-downin-place
  • Arrays & HashingMediumAuto-graded
    Group Paths Whose File Contents Match Exactly

    Group file paths whose contents are identical, using cheap filters like size and digest, with an exact comparison to confirm. Output is sorted groups of two or more paths.

    Arrays & Hashinghashinggroupingstringssorting
  • Greedy & IntervalsMediumAuto-graded
    Minimum Concurrent Resources for Overlapping Intervals

    Find the maximum number of overlapping intervals at any instant using sweep line or heap techniques.

    Greedy & Intervalsintervalssweep-lineheapsorting
  • Trees & GraphsEasyAuto-graded
    Nearest Shared Ancestor in an Array-Encoded Binary Tree

    Find the deepest node that is an ancestor of two given values in a binary tree stored as a heap-indexed array, using a parent map and ancestor walk.

    Trees & Graphsbinary-treelowest-common-ancestorbfshash-map
  • Math & Bit ManipulationEasyAuto-graded
    Shelf Stock Versus Random Demand in a Checkout Line

    Compute binomial probabilities that a limited stock covers random demand from a line of customers, both as at most M buyers and as exactly M buyers.

    Math & Bit Manipulationprobabilitybinomialcombinatoricsmath
  • Greedy & IntervalsMediumAuto-graded
    Largest Set of Compatible Time Slots on One Worker

    Find the largest subset of half-open time intervals that can run on one worker without overlap, testing greedy interval selection by earliest finish.

    Greedy & Intervalsgreedyintervalssorting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Badges for a Row of Scored Players

    Greedy two-pass array problem: assign the minimum total badges so each player gets at least one and any player scoring higher than an adjacent player gets strictly more badges.

    Greedy & Intervalsgreedyarraytwo-passneighbors
  • Arrays & HashingEasyAuto-graded
    Filter Names Absent From a Blocklist After Cleanup

    Return the items of one string list whose trimmed, lowercased form is missing from a second list, keeping original spelling, order, and duplicates; tests hash sets and normalization.

    Arrays & Hashinghash-setstringsnormalizationfiltering
  • Trees & GraphsHardAuto-graded
    Schedule Tasks with Precedence Constraints

    Determine a valid sequential execution order for a set of tasks given dependency rules, or detect impossible circular dependencies.

    Trees & Graphstopological sortgraphbfsdegree count
  • Greedy & IntervalsMediumAuto-graded
    Courier Pay with Overlap Multipliers, Waits and Peak Windows

    Sweep-line over time intervals: pay grows with the square of concurrent deliveries, store-wait minutes are isolated, and peak windows double the rate.

    Greedy & Intervalssweep-lineintervalsevent-sortingsimulation
  • Greedy & IntervalsEasyAuto-graded
    Indices of Ranges Fully Inside a Query Range

    Scan a list of closed integer ranges and return the indices of those lying entirely within a given query range, testing inclusive boundary handling.

    Greedy & Intervalsintervalsarrayscanboundary-conditions
  • Data Structure DesignEasyAuto-graded
    Replay Operations on a Fixed-Capacity FIFO Buffer

    Simulate a bounded first-in-first-out buffer over a list of put and take commands, rejecting any command that would have to wait.

    Data Structure Designqueuesimulationdesignfifo
  • Trees & GraphsMediumAuto-graded
    Hub Node Pair Counting on a Weighted Tree with Divisible Distances

    Count, for each node of a weighted tree, the unordered pairs of other nodes at distances divisible by k and lying in different branches around that node.

    Trees & Graphstreedfscountingcombinatorics
  • Data Structure DesignEasyAuto-graded
    Field-Level Visibility Filter for Employee Records

    Build a function that returns only the employee record fields a viewer may see, based on admin status, identity, department, reporting line, and view type.

    Data Structure Designaccess-controldictionariessimulationrule-evaluation
  • Data Structure DesignMediumAuto-graded
    Sliding Log Window: Distinct Tags and Dominant Tag Since a Cutoff

    Replay operations on a bounded, timestamp-ordered log of the newest entries, answering cutoff queries with the distinct key count and the most frequent key (smallest on ties).

    Data Structure Designdesignhash-mapbinary-searchsliding-window
  • Linked ListsMediumAuto-graded
    Locate the Junction of Two Chains in a Successor Table

    Find the first node of one chain that also lies on a second chain, where both chains are encoded in a single successor array, or report -1 if they never converge.

    Linked Listslinked-listhash-settwo-pointersintersection
  • Heaps, Sorting & SearchEasyAuto-graded
    Permutation Search Sort: Order a List by Brute Force

    Implement a factorial-time sort that tries arrangements until one is non-decreasing, handling duplicates and empty input, and reason about its cost.

    Heaps, Sorting & Searchsortingpermutationsbrute-forcecomplexity-analysis