KatInterview

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

Data Structure Design Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 301–330 of 362 results

  • Data Structure DesignMediumModel answer
    Build a Fox-and-Geese Turn-Based Grid Game Engine

    Model the board state, movement rules, and win conditions for an asymmetric two-player grid game where geese try to reach the far side while foxes hunt them.

    Data Structure Designobject-oriented designgame enginesimulationstate machine
  • Data Structure DesignHardModel answer
    Tiered Cache Manager with Expiry and Weighted Retrieval

    Implement a multi-level cache that evicts expired entries, checks tier utilization, and retrieves the highest-weight item from any eligible tier.

    Data Structure Designheaplazy-deletionmulti-levelexpiration
  • Data Structure DesignMediumModel answer
    Firewall Rule Engine with Prefix Matching

    Build a rule-based IP filter supporting CIDR blocks, priority resolution, and efficient queries for single IPs and prefix ranges.

    Data Structure Designtrienetworkingbit-manipulation
  • Data Structure DesignMediumModel answer
    Transactional Key-Value Store with Rollback Support

    Build a key-value store supporting nested transactions with set, get, delete, begin, commit, and rollback operations.

    Data Structure Designtransactionsstackstate-managementkey-value-store
  • Data Structure DesignMediumModel answer
    Finding Consecutive Duplicates in Subarrays

    Design data structures to efficiently detect sequences of identical elements in an array and answer queries about their presence in suffixes.

    Data Structure Designarray-scanningpreprocessingrange-queries
  • Data Structure DesignMediumModel answer
    Build a Policy Engine for Expense Validation

    Create a rule evaluation system that checks expense submissions against JSON-defined policies without deploying new code.

    Data Structure Designdata-structuresparsingvalidation
  • Data Structure DesignMediumModel answer
    Data Structure Selection: Complexity and Trade-offs

    Analyze time and space complexity for standard data structures and explain when to use each based on access patterns and constraints.

    Data Structure Designdata-structurescomplexity-analysistrade-offs
  • Data Structure DesignMediumModel answer
    Complete Concrete Classes in an Abstract Base Hierarchy

    Implement missing methods in concrete subclasses that inherit from abstract base classes while maintaining type safety and LSP compliance.

    Data Structure Designobject-oriented-designinheritanceabstractiondesign-patterns
  • Data Structure DesignMediumModel answer
    Build a Flexible Tennis Game Score Tracker

    Create a scoring system for a single tennis game that records points, displays readable scores, detects game completion, and supports multiple rule variants.

    Data Structure Designobject-oriented-designstrategy-patternstate-management
  • Data Structure DesignMediumModel answer
    Lottery Bucket with Constant-Time Operations and Duplicates

    Build a data structure supporting O(1) add, remove, and uniform random selection where duplicate entries are treated as separate items.

    Data Structure Designhash-tablearrayrandomizationduplicates
  • Data Structure DesignMediumModel answer
    Hierarchical Task Tracker: OO Domain Model & Service Layer

    Design and implement an object-oriented model for a nested task manager with status propagation, recursive deletion, and attribute-based filtering.

    Data Structure Designobject-oriented designtree traversalAPI designcomposite pattern
  • Data Structure DesignMediumModel answer
    Dense-Index Data Structure Code Review

    Review a structure storing items under contiguous integer keys with O(1) random selection and removal while preserving index density.

    Data Structure Designcode-reviewdata-structuresrandomizationcomplexity-analysis
  • Data Structure DesignMediumModel answer
    Greedy Card Selection with Dynamic Deck State

    Simulate a threshold-based card selection strategy that accounts for a shrinking deck, tracking which cards remain available after each decision.

    Data Structure Designfenwick-treegreedysimulationbinary-indexed-tree
  • Data Structure DesignMediumModel answer
    Area-Weighted Random Point Sampling Across Multiple Squares

    Design a class for uniform random point sampling inside a square, then extend it to sample uniformly from the union of N non-overlapping squares.

    Data Structure Designprobabilityprefix-sumssamplinggeometry
  • Data Structure DesignHardModel answer
    Build an Idempotent Financial Account System

    Create an in-memory account manager that enforces balance rules, prevents duplicate processing via transaction IDs, and detects conflicting retries.

    Data Structure Designfinancial-systemsidempotencydata-structuresstate-management
  • Data Structure DesignHardModel answer
    Design a Thread-Safe Resource Pool with RAII Handles

    Build a concurrent object pool in C++ that safely manages reusable resources with blocking acquisition, automatic return via RAII, and graceful shutdown.

    Data Structure Designconcurrencyc++raiithread-safety
  • Data Structure DesignMediumModel answer
    Call Channel State Manager

    Build a stateful manager that allows exactly one active two-party call at a time, with proper validation and error handling.

    Data Structure Designstate-machineobject-oriented-designvalidationexceptions
  • Data Structure DesignMediumModel answer
    Build a Fee Calculator with Comprehensive Test Coverage

    Write a service class that computes fees based on business rules, then extend it and write unit tests covering normal cases, boundaries, and errors.

    Data Structure Designtestingvalidationobject-oriented-design
  • Data Structure DesignHardModel answer
    Build a Function Pipeline and JSON Serialization Mixin

    Create a left-to-right function compositor and a mixin class that serializes object attributes to JSON with configurable privacy filtering.

    Data Structure Designpythonclosuresmetaprogrammingserialization
  • Data Structure DesignEasyModel answer
    Build an Inventory Manager with Nested Recipe Expansion

    Implement a service that models recipes with nested dependencies, validates acyclic graphs, and atomically decrements raw inventory when orders succeed.

    Data Structure Designobject-oriented-designgraph-validationatomicityconcurrency
  • Data Structure DesignMediumModel answer
    Build a Social Payment Platform with Friend Connections

    Implement an in-memory system that handles user registration, friendship management, and peer-to-peer money transfers with proper validation.

    Data Structure Designobject-oriented-designhash-tablesstate-management
  • Data Structure DesignMediumModel answer
    Build a Tic-Tac-Toe Game Engine with Move Validation

    Design and implement a class that tracks board state, validates moves, detects winners, and enforces turn-based gameplay for a 3×3 grid game.

    Data Structure Designstate-machinegame-logicobject-oriented-design
  • Data Structure DesignMediumModel answer
    Scored Catalog Rotator: Ordered Traversal with Live Updates

    Design an in-memory playlist that always serves the highest-scored unseen item per round, supports live score changes, and is safe for concurrent callers.

    Data Structure Designheaptreemapconcurrencydata-structure-design
  • Data Structure DesignMediumModel answer
    Restaurant Query and Order Analytics System

    Design data structures and algorithms to query restaurants by price and distance, then compute order statistics and rankings over time windows.

    Data Structure Designdata-structuresalgorithmstime-seriesheap
  • Data Structure DesignMediumModel answer
    Build an In-Memory Meal Catalog with Search and Updates

    Create a service that stores meal records with auto-incrementing IDs, normalized fields, atomic modifications, and filtered search with multiple sort orders.

    Data Structure Designdata-structuresstate-managementindexingnormalization
  • Data Structure DesignMediumModel answer
    Credit System with Expiration and Time-Ordered Replay

    Build a credit tracking system where allocations expire, spending prioritizes earliest expiration, and operations arrive out of chronological order.

    Data Structure Designheaptime-orderingdata-structure-design
  • Data Structure DesignMediumModel answer
    Design a Fixed-Heap Memory Manager

    Build malloc and free over a fixed byte array, comparing allocation strategies and analyzing fragmentation trade-offs.

    Data Structure Designmemory-managementdata-structurescomplexity-analysis
  • Data Structure DesignMediumModel answer
    Build a Rule-Based Board Game State Manager

    Design an immutable, thread-safe game engine with pluggable validation rules for a turn-based strategy game.

    Data Structure Designobject-oriented-designimmutabilitystrategy-patternconcurrency
  • Data Structure DesignMediumModel answer
    Binary Protocol for String Dictionary Persistence

    Build a binary encoder and decoder for string dictionaries with strict validation of format integrity, size bounds, and key ordering.

    Data Structure Designserializationbinary-protocolsvalidationdata-structures
  • Data Structure DesignMediumModel answer
    Build Directory Tree Operations with Path Parsing

    Implement directory creation and listing for an in-memory hierarchical structure with automatic parent creation and path normalization.

    Data Structure Designtreetriepath-parsingstring-manipulation