KatInterview

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

Coding Interview Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 451–480 of 650 results

  • Math & Bit ManipulationHardModel answer
    Do Two Walkers Ever Share the Same Tile?

    Determine if two entities moving on an infinite 2D grid ever occupy the same cell at the same integer time step.

    Math & Bit Manipulationgeometrysimulationinterval-arithmetictwo-pointers
  • Arrays & HashingEasyModel answer
    Identify the Most Common Function Call in Application Logs

    Determine which function name occurs most often in a list of log entries and report its occurrence count.

    Arrays & Hashinghash-mapfrequency-countingiteration
  • StringsMediumModel answer
    Rule Engine with Operator Precedence and Quoted Strings

    Build a transaction filter that evaluates accept/block rules in sequence, supporting field equality, boolean logic, AND/OR operators, and parentheses.

    Stringsparsingstring-matchingoperator-precedencetokenization
  • Arrays & HashingMediumModel answer
    Three-Problem Algorithmic Challenge Set

    Solve three independent problems: tournament match counting, grid traversal with movement commands, and finding maximum sum of digit-disjoint pairs.

    Arrays & Hashingsimulationgraph-traversalbit-manipulationdfs
  • StringsMediumModel answer
    Build a CSV Parser from Scratch with Corruption Handling

    Write a from-scratch CSV tokenizer and data structure for downstream consumers, then extend it to handle rows with missing or extra fields.

    Stringsparsingcsvstring-manipulationerror-handling
  • Data Structure DesignMediumModel answer
    Build a Weighted Consistent Hash Ring

    Design and code a hash ring that maps keys to servers with virtual nodes, supporting weighted capacity and minimal key movement on topology changes.

    Data Structure Designhashingdistributed-systemsdata-structuresbinary-search
  • Data Structure DesignMediumModel answer
    Dependency-Aware Job Scheduler with Priority Queues

    Build an in-memory scheduler that tracks job prerequisites, selects the next runnable job by a four-field priority rule, supports filtered queries, and detects deadlocks.

    Data Structure Designheaptopological-sortgraphsimulation
  • Data Structure DesignMediumModel answer
    Continuous-Batch Inference Loop with Slot Refilling

    Implement a dynamic batching generation loop that keeps a fixed-size batch full by refilling completed slots from a waiting queue until all requests are served.

    Data Structure Designbatchinginferencesimulationqueue
  • Data Structure DesignMediumModel answer
    Model a Prepaid Spending Account with Transaction Limits

    Design a class hierarchy that tracks a spending cap, running balance, and transaction history while safely handling concurrent charges and edge-case inputs.

    Data Structure Designobject-oriented designconcurrencystate managementPython
  • StringsMediumModel answer
    Rule-Driven CSV Validator with Cross-Field Word Overlap

    Design and implement a configurable validator that flags per-field rule violations and excessive word overlap across fields in a company CSV.

    Stringscsv-parsingvalidationstring-normalizationrule-engine
  • Trees & GraphsMediumModel answer
    Propagating Allow/Deny Permissions Through an Inheritance DAG

    Given a DAG where each node carries allow and deny lists, compute every node's effective permissions by inheriting and merging rules along edges in topological order.

    Trees & Graphsgraphstopological-sortpermissionsDAG
  • Trees & GraphsMediumModel answer
    Rebuild a Binary Tree from Pre- and In-Order Sequences

    Given preorder and inorder traversal arrays of a binary tree with unique values, reconstruct the tree in O(n) time and O(n) space.

    Trees & Graphsbinary-treerecursionhash-maptraversal
  • Math & Bit ManipulationMediumModel answer
    Four Labeled Boxes, Only One Label Tells the Truth

    Use a complementary pair of quantified statements to pin down which label is false, then read off the forced conclusion.

    Math & Bit Manipulationlogicpropositional-reasoningquantifiersconstraint-satisfaction
  • Data Structure DesignMediumModel answer
    Fix a Broken Round-Robin Load Balancer

    Debug and repair a round-robin router that mis-assigns requests when servers are added, removed, or marked unhealthy, then write tests covering the edge cases.

    Data Structure Designround-robinload-balancingdebuggingconcurrency
  • Data Structure DesignMediumModel answer
    Library Loan Alert Engine: Holds, Checkouts, and Due Reminders

    Design a notification manager for a book lending system that handles hold queues, checkout allocation, and idempotent due-date alerts.

    Data Structure Designheapsimulationidempotencyqueue
  • Trees & GraphsMediumModel answer
    Closest Shared Ancestor for a Group of Org-Chart Nodes

    Build a validated org-chart tree from manager–report pairs and find the deepest node that is an ancestor of every node in a given set.

    Trees & Graphslowest-common-ancestorbinary-liftingtree-traversalinput-validation
  • Stacks & QueuesHardModel answer
    Build a Type-Safe C++ Stack from Raw Storage

    Implement a generic, dynamically growing C++ stack using raw memory and placement new, then defend every lifetime, allocation, and call-semantics decision.

    Stacks & QueuesC++memory-managementtemplatesobject-lifetime
  • Trees & GraphsMediumModel answer
    Chain All Words Into One String via Shared Letters

    Given a list of words, merge them into one string by joining where each word's last letter matches the next word's first letter, dropping the duplicate.

    Trees & Graphseulerian-pathgraphstringshierholzer
  • Data Structure DesignMediumModel answer
    Extensible Card Hand Evaluator with Pluggable Rules

    Design and incrementally build a card-hand evaluator that ranks hands, resolves ties deterministically, adds new categories, and applies a swappable discard rule.

    Data Structure Designobject-oriented designextensibilitygame logic
  • Data Structure DesignMediumModel answer
    File Storage Manager with Quota Enforcement

    Build an in-memory file manager that tracks user storage, enforces capacity limits, and evicts largest files when quotas shrink.

    Data Structure Designhash-mapheaplazy-deletionquota-management
  • Data Structure DesignMediumModel answer
    Sliding-Window Trending URLs with Deduplication

    Design a data structure that tracks the most-visited URLs over a configurable recent time window, with idempotent inserts and efficient eviction.

    Data Structure Designsliding-windowheaphash-mapstreaming
  • Data Structure DesignMediumModel answer
    Random Draw from a Mutable Membership Set in O(1)

    Build a container that registers and removes integer keys and returns a uniformly random current key, all in average constant time.

    Data Structure Designhash-maparrayrandomizedconstant-time
  • Greedy & IntervalsMediumModel answer
    Packing a Fixed-Size Block from a Large Mempool with CPFP

    Design a fee-maximizing transaction selector for a size-capped block, extend it to parent/child dependencies with CPFP scoring, and derive a minimum child fee.

    Greedy & Intervalsgreedyknapsackdependency-trackingcryptocurrency
  • Trees & GraphsMediumModel answer
    Minimum Arrival Time in a Scheduled Transit Network

    Find the earliest time a traveler can reach a destination station given a fixed train timetable, then reconstruct the full itinerary with transfers and waits.

    Trees & Graphsgraph-searchdijkstrabfstime-expanded-graph
  • Data Structure DesignMediumModel answer
    File Storage with Quotas, Copy, and Compression

    Build an in-memory file system tracking per-user storage limits, supporting file operations including duplication, compression, and quota-driven eviction.

    Data Structure Designhash-mapheapobject-oriented-designbookkeeping
  • Dynamic ProgrammingHardModel answer
    Two-Station Job Scheduling with Setups and a Downtime Window

    Assign and sequence three jobs across two parallel stations to minimize makespan, handling sequence-dependent changeovers, a precedence constraint, and a station blackout period.

    Dynamic Programmingschedulingcombinatorial-optimizationbranch-and-boundNP-hardness
  • Greedy & IntervalsMediumModel answer
    First Open Meeting Window Across All Employees

    Sweep merged busy intervals to find the earliest gap of a required duration that fits within every employee's working hours.

    Greedy & Intervalsintervalsheapmergescheduling
  • Data Structure DesignMediumModel answer
    Build a Bounded In-Memory File System with Auto-Rename

    Design a trie-backed file system supporting path-based file insertion and directory listing, with a per-directory capacity cap and OS-style duplicate renaming.

    Data Structure Designtriehash-mapfile-systemOOP
  • Data Structure DesignMediumModel answer
    Build an Expiry-Aware LRU Cache Without Scanning Every Key

    Design an in-memory cache that enforces capacity with LRU eviction and per-entry TTL, keeping expiration efficient without iterating all keys.

    Data Structure Designcachelruttlconcurrency
  • Data Structure DesignMediumModel answer
    Order Book Simulator with Fair Volume Participation

    Build a limit order matching engine, then add participation-rate execution logic for one client, and finally extend to multiple clients with fair allocation.

    Data Structure Designorder-bookpriority-queuesimulationgreedy