KatInterview

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

Coding Interview Problems

Practice 5991 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.

5991
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 361–390 of 2119 results

  • Arrays & HashingEasyAuto-graded
    Collapse Round-Trip Routes into Distinct City Pairs

    Normalize directed city pairs into unordered ones, remove duplicates, and return them in sorted order, testing canonicalization with hashing and sorting.

    Arrays & Hashinghashingsortingdeduplicationcanonical-form
  • Trees & GraphsMediumAuto-graded
    Route Between Two Nodes of an Implicit Recursive Tree

    Find the unique path between two pre-order-indexed nodes in a huge recursively defined tree, using subtree sizes to navigate without building it.

    Trees & Graphstreelcarecursionpre-order
  • Arrays & HashingMediumAuto-graded
    Busiest Network Addresses With Tie-Inclusive Top Ten Cutoff

    Normalize IPv4/IPv6 strings, skip invalid ones, count occurrences, and return the top ten addresses while keeping every address tied at the tenth-place frequency.

    Arrays & Hashinghash-mapcountingsortingstring-parsing
  • Trees & GraphsMediumAuto-graded
    Strongest Signal Route in a Lossy Link Network

    Find the route between two nodes in an undirected graph that maximizes the product of per-link delivery probabilities, using a Dijkstra-style search with a max-priority queue.

    Trees & Graphsgraphdijkstraheapshortest-path
  • Data Structure DesignEasyAuto-graded
    Replay Tennis Game Commands and Report Scores

    Simulate a single tennis game from a command log, tracking points, deuce, advantage and the winner, and return each score query's text.

    Data Structure Designsimulationstate-machinedesignstrings
  • Heaps, Sorting & SearchMediumAuto-graded
    Boosting Your Budget With a Limited Number of Ventures

    Greedy selection with a sorted unlock pointer and a max-heap: repeatedly pick the most profitable venture whose entry threshold fits the current funds, up to a fixed number of picks.

    Heaps, Sorting & Searchheapgreedysortingpriority-queue
  • Data Structure DesignHardAuto-graded
    Versioned Cache and Longest Dependency Chain

    Process a series of timestamped key-value operations and find the longest non-cyclic path in a dependency graph.

    Data Structure Designdesign-dstrees-graphsdynamic-programmingbinary-search
  • Data Structure DesignHardAuto-graded
    Simulate Alternating Tic-Tac-Toe Game Engine

    Process a series of game instructions to maintain state, validate turns and positions, and return outcome status for each operation.

    Data Structure Designdesign-dsarraysstate-machine
  • Trees & GraphsMediumAuto-graded
    Balanced BST Level-Order Output from a Sorted Sequence

    Build a height-balanced BST from a sorted list using a fixed middle-element rule, then serialize it level by level with null placeholders.

    Trees & Graphsbinary-search-treedivide-and-conquerrecursionlevel-order-traversal
  • Data Structure DesignMediumAuto-graded
    Shift Ledger: Rates, Promotions and Bonus Windows

    Simulate a command stream for a shift ledger with deferred pay-rate changes, merged global bonus windows and a ranking of employees by hours worked.

    Data Structure Designdesignsimulationinterval-mergingsorting
  • Arrays & HashingMediumAuto-graded
    Clockwise Grid Walk Around Obstacles and Visited Cells

    Simulate a clockwise inward walk over a grid with obstacle cells, turning on edges, obstacles and visited cells, and stopping when every direction is closed.

    Arrays & Hashingmatrixsimulationspiralgrid
  • Stacks & QueuesMediumAuto-graded
    Parenthesized Integer Calculator with Unary Negation

    Evaluate an integer expression with +, -, *, /, parentheses and unary minus in one iterative pass, using precedence rules and division that truncates toward zero.

    Stacks & Queuesstackparsingexpression-evaluationshunting-yard
  • Trees & GraphsMediumAuto-graded
    Locked Gates Grid: Fewest Steps With Collected Keys

    Find the fewest moves through a grid where lowercase cells give keys and uppercase cells are gates, using BFS over position plus the set of collected keys.

    Trees & Graphsbfsgridstate-space-searchkeys-and-doors
  • Trees & GraphsMediumAuto-graded
    Reconstruct Hierarchical Execution Trees from Trace Records

    Reassemble an unordered collection of trace span objects into a forest of child-linked execution trees sorted chronologically.

    Trees & Graphstreeshash-tablesortinggraph
  • Data Structure DesignMediumAuto-graded
    Resumable Batch Reader for a Linked Page Feed

    Simulate a stateful reader that serves batches of N items in order from a chained page feed, buffering surplus items and handling empty pages, loops and the end of the feed.

    Data Structure Designdesignpaginationbufferingsimulation
  • StringsMediumAuto-graded
    Tally Slices Whose Letters Are All Different

    Count every contiguous slice of a lowercase string in which no letter appears twice, using a linear-time sliding window.

    Stringssliding-windowtwo-pointersstringscounting
  • Data Structure DesignMediumAuto-graded
    Replay Bounded Cache Commands with Recency Eviction

    Simulate a fixed-capacity key-value store that evicts its stalest entry, replaying a command log in O(1) per step using a hash map and recency ordering.

    Data Structure Designlru-cachehash-mapdoubly-linked-listsimulation
  • Data Structure DesignMediumAuto-graded
    Replay a Recency-Evicting Cache from a Command Log

    Simulate a fixed-size cache that evicts the least recently used entry, by replaying text commands and collecting the answers to lookups in order.

    Data Structure Designlru-cachehash-mapordered-dictsimulation
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Bounded Recency-Evicting Store

    Simulate a fixed-size key-value store that evicts the stalest entry, replaying a list of get/put commands and returning each command's result.

    Data Structure Designhash-maplinked-listordered-dictsimulation
  • Trees & GraphsEasyAuto-graded
    Group Hierarchy Members by Depth Level

    Construct an adjacency graph from reporting links and perform a level-order traversal to group node IDs by depth.

    Trees & Graphstrees-graphsbfshash-map
  • Greedy & IntervalsMediumAuto-graded
    Minimum Time Slots for Cooldown-Constrained Jobs

    Compute the shortest timeline needed to run labeled jobs when equal labels must be separated by a cooldown, using frequency counting and a greedy frame argument.

    Greedy & Intervalsgreedycountingschedulingmath
  • Math & Bit ManipulationMediumAuto-graded
    Two-Segment Rider Model: Weekly Activity, Posterior, Forecast

    Compute three probabilities from a two-group mixture model: at-least-one-success over n days, a Bayesian posterior after all-success streaks, and a posterior predictive forecast.

    Math & Bit Manipulationprobabilitybayesmixture-modelcomplement-rule
  • Trees & GraphsMediumAuto-graded
    Best Plot After Reclaiming a Single Water Tile

    Find the largest connected land region achievable by turning at most one water cell into land, which tests component labeling and merging neighbors without double counting.

    Trees & Graphsgridflood-fillconnected-componentsdfs
  • Trees & GraphsMediumAuto-graded
    Two Teams With Rival Pairs Kept Apart

    Decide whether a set of people can be placed into two teams so that no rival pair shares a team, which tests graph 2-coloring across possibly disconnected components.

    Trees & Graphsgraphbipartitebfscoloring
  • Data Structure DesignMediumAuto-graded
    Simulate a Cursor Editor with Sticky-Column Vertical Moves

    Replay a log of editor commands (type, backspace, move in four directions, render) on a single-cursor multi-line buffer, with a column that persists across vertical moves.

    Data Structure Designsimulationdesigncursorstrings
  • Data Structure DesignMediumAuto-graded
    Versioned Key-Field Store with Expiry and Time Travel

    Simulate a timestamped two-level store with expiring values, conditional updates, sorted prefix scans and historical lookups, driven by a batch of operations.

    Data Structure Designdesignhash-mapbinary-searchttl
  • Trees & GraphsMediumAuto-graded
    Render a Nested Folder Structure as Indented Lines

    Traverse a nested dictionary tree in pre-order, tracking depth to build indented lines with a fixed marker, preserving the given child order.

    Trees & Graphstree-traversaldfsstackstrings
  • Math & Bit ManipulationHardAuto-graded
    Count Substrings Rearrangeable into Palindromes

    Given a list of strings, count the number of contiguous substrings in each string whose characters can be permuted to form a valid palindrome.

    Math & Bit Manipulationbit-manipulationhash-tablestringsprefix-sum
  • StringsMediumAuto-graded
    Rolling Up Page Views Through Hostname Suffixes

    Aggregate per-host view counts so every host and each of its parent suffixes gets the total of itself and all hosts beneath it, using suffix enumeration and a hash map.

    Stringshash-mapstringsparsingsuffix-enumeration
  • Arrays & HashingEasyAuto-graded
    Determine Highest Single Transaction Stock Profit

    Find the maximum gain possible from buying and selling a stock once, given a sequence of daily values.

    Arrays & Hashingarraysgreedydynamic-programming