KatInterview

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

Arrays & Hashing Interview Problems

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

5969
Problems
2211
Auto-graded
15
Topics
273
Added today

Showing 61–90 of 475 results

  • Arrays & HashingMediumAuto-graded
    Bayesian Inference for Coin Flipping

    Evaluate posterior coin probabilities, posterior predictive likelihoods, and expected stopping times following observed heads.

    Arrays & Hashingprobabilitybayes-theoremexpected-valuebayesian-inference
  • Arrays & HashingMediumAuto-graded
    Longest Strictly Rising Window After One Edit

    Find the longest contiguous strictly increasing window in an integer array after replacing at most one element with any integer, using prefix and suffix run lengths.

    Arrays & Hashingarrayssliding-windowprefix-suffixdynamic-programming
  • Arrays & HashingEasyAuto-graded
    Tally Opening Click-Paths Across Shoppers

    Group timestamped events by user, order them in time, and count how many distinct users share each opening action sequence of length up to k.

    Arrays & Hashinghash-mapgroupingsortingprefixes
  • Arrays & HashingMediumModel answer
    Cyclic Shifts and Cell-Level Keyword Lookup in CSV Text

    Shift an integer array left or right by k using modular arithmetic, then locate every occurrence of one or more keywords in a simple CSV string, reporting row, column and offset in the cell.

    Arrays & Hashingarray-rotationmodular-arithmeticstring-searchcsv-parsing
  • 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
  • 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
  • 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
  • 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
  • Arrays & HashingMediumAuto-graded
    Subarrays Whose Matching-Element Count Hits a Residue

    Count subarrays where the number of elements congruent to a residue, taken modulo the same base, equals that residue, using prefix remainders and a frequency table.

    Arrays & Hashingprefix-sumhash-mapmodular-arithmeticsubarrays
  • Arrays & HashingMediumAuto-graded
    Monthly Signup Cohorts: Day-30 Return Rate

    Group users by first-activity month and compute the share who return exactly 30 days later, excluding users whose day 30 lies beyond the last observed date.

    Arrays & Hashinghash-mapdatescohort-analysisgrouping
  • Arrays & HashingMediumAuto-graded
    Equicorrelation Floor, Reverse Slope, and Max-Min Covariance

    Combine three closed-form statistics results: the lowest shared correlation of three variables, a reverse regression slope from R² and a slope, and the covariance of the max and min of two uniforms.

    Arrays & Hashingcorrelationlinear-regressionorder-statisticscovariance
  • Arrays & HashingEasyAuto-graded
    Peak Request Load Over a Fixed Run of Minutes

    Find the largest total of any k consecutive values in a list, testing fixed-size sliding window technique and the ability to avoid recomputing overlapping sums.

    Arrays & Hashingsliding-windowarraysprefix-sum
  • Arrays & HashingMediumAuto-graded
    Maximum Consecutive Ones With a Single Bit Repair

    Find the longest stretch of 1s achievable in a binary list when at most one 0 may be changed to 1, using a two-pointer window that tolerates one zero.

    Arrays & Hashingsliding-windowtwo-pointersbinary-array
  • Arrays & HashingEasyAuto-graded
    Financial Payback and Sensitivity Analysis for Renewable Energy

    Perform quantitative financial modeling and sensitivity analysis for renewable energy pilot projects.

    Arrays & Hashingfinancesensitivity-analysismathstatistics
  • Arrays & HashingMediumAuto-graded
    Streak Follow-Up Chance and Two-Bot Proportion Comparison

    Return the next-success probability under independence, plus a pooled two-proportion z statistic and two-sided p-value comparing two success rates.

    Arrays & Hashinghypothesis-testingtwo-proportion-z-testconditional-probabilitynormal-distribution
  • Arrays & HashingMediumAuto-graded
    Greedy First-Fit Placement of Shapes on a Grid

    Simulate placing fixed binary shapes onto a grid at the first row-major position where their filled cells hit only empty cells, labelling each by its index.

    Arrays & Hashingsimulationmatrixgridbrute-force
  • Arrays & HashingMediumAuto-graded
    Count Contiguous Runs That Add Up to a Goal

    Count contiguous non-empty subarrays whose elements sum to a goal value, using running prefix sums with a frequency map to handle negatives and zeros in linear time.

    Arrays & Hashingprefix-sumhash-mapsubarraycounting
  • Arrays & HashingMediumAuto-graded
    Tightest Window Covering K Different Values

    Find the minimum length of a contiguous block of an integer list containing at least k different values, using a sliding window with a frequency map.

    Arrays & Hashingsliding-windowtwo-pointershash-map
  • Arrays & HashingMediumAuto-graded
    Tally a Ten-Frame Pin-Knocking Game from Raw Throws

    Convert a flat list of throws into a ten-frame total, applying look-ahead bonuses for strikes and spares, including fill throws in the last frame.

    Arrays & Hashingsimulationarraylook-aheadpointer-walk
  • Arrays & HashingEasyAuto-graded
    Order-Preserving Unique Values from a Mixed List

    Tests using a hash-based structure to drop repeated values from a list while keeping first-occurrence order, in linear time and without modifying the input.

    Arrays & Hashinghash-setordered-dictarraysdeduplication
  • Arrays & HashingMediumModel answer
    Detect 8-Hour Cooling Streaks in a Flaky Forecast Feed

    Build a service that checks a city's latitude, pulls a 72-hour forecast from an unreliable API with proper retries, and returns every 8-hour span of strictly falling, gapless hourly temperatures.

    Arrays & Hashingsliding-windowretry-backoffapi-integrationerror-handling
  • Arrays & HashingMediumAuto-graded
    Rank Documents by Query Relevance with Smoothed TF-IDF

    Tests hashing and counting over text: tokenize, compute smoothed IDF for query terms, score every document, and sort by descending score with an index tie-break.

    Arrays & Hashinghashingtf-idftokenizationsorting
  • Arrays & HashingEasyAuto-graded
    Execute In-Memory Key-Value Storage Commands

    Simulate an in-memory key-value dictionary given a sequence of insertion, lookup, and deletion instructions.

    Arrays & Hashingarrayshash-mapdata-structuresdesign
  • Arrays & HashingEasyModel answer
    Clean and Reconcile Account Snapshots from a JSON Feed

    Parse a JSON list of account records with exact decimal arithmetic, drop invalid rows, keep the newest record per account, and report a rounded total plus a per-account map.

    Arrays & Hashingpythonjsondecimaldeduplication
  • Arrays & HashingMediumAuto-graded
    Stream Token Lists into Fixed-Size Blocks with a Validity Mask

    Concatenate truncated token lists into equal-length blocks, zero-pad the last one, and build a parallel 0/1 mask marking real tokens versus padding.

    Arrays & Hashingarrayssimulationtwo-pointersbatching
  • Arrays & HashingMediumAuto-graded
    Bucket Words by Letter Multiset Without Per-Word Sorting

    Cluster words that share identical letter counts into ordered buckets, using a hashable frequency key rather than sorting each word's letters, while preserving duplicates and order.

    Arrays & Hashinghash-mapstringsanagramsfrequency-count
  • Arrays & HashingEasyAuto-graded
    Monthly Hit Tracks: Overall and Per-Region Leaderboards

    Filter streaming events by duration and date window, count plays per track, and produce a global top 5 and per-country top 3 with deterministic tie-breaking.

    Arrays & Hashinghash-mapcountingsortinggrouping
  • Arrays & HashingEasyAuto-graded
    Keep Only First Appearances in an Integer List

    Tests using a hash set alongside a list to filter repeated integers in one pass while preserving first-appearance order, in linear time.

    Arrays & Hashinghash-setarraysdeduplicationorder-preservation
  • Arrays & HashingMediumAuto-graded
    Users With a Qualifying Login Session in an Unordered Event Log

    Pair sign-in and sign-out events per user from an unsorted log using chronological order and FIFO matching, and report users with a session within a time limit.

    Arrays & Hashinghash-mapsortingqueuesimulation
  • Arrays & HashingMediumAuto-graded
    Seeded Two-Round K-Means with Spread-Out Starting Centers

    Simulate k-means++ seeding with a fixed RNG protocol, then run two assign/update rounds and report clusters, centroids and final squared error.

    Arrays & Hashingsimulationclusteringrandomized-samplingfloating-point