Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 4,826–4,850
Given a comma-separated preorder string using '#' for nulls, determine whether it represents a valid binary-tree preorder serialization without reconstructing the tree. The…
General practice
Given a set of video clips as intervals, find the minimum number of clips (you may cut clips) whose segments can cover the entire target…
General practice
Given a network where each viewer converts to a streamer once a certain number of their neighbors are streaming, determine the minimal initial seed set…
General practice
Starting at index 0, pick an increasing subsequence of positions to maximize the sum of their nums values minus x each time you move between…
General practice
Given a wordlist and queries, implement a spellchecker that for each query returns the exact case-sensitive match if present, otherwise the first case-insensitive match…
General practice
Determine whether Alice (first player) has a forced win in a two-player partisan game where they alternately delete any non-empty substring of s with an…
General practice
Given a string, return the total number of vowel occurrences across all its substrings. Use a combinatorial approach: each vowel at index i contributes (i+1)*(n-i)…
General practice
Simulate a robot on a width×height grid starting at (0,0) facing East that moves forward step-by-step and turns 90° counterclockwise whenever the next cell is…
General practice
Implement a warehouse inventory manager that processes a sequence of restock, fulfill, and query operations while respecting capacity and availability constraints. The core…
General practice
Determine whether, using fill/empty/pour operations on two jugs of capacities x and y, you can measure exactly target liters. This is true iff target ≤…
General practice
Given initial full bottles and a conversion rate of empty bottles to one full, compute the maximum number of bottles you can drink by repeatedly…
General practice
Given initial full bottles and an exchange rule that trades numExchange empty bottles for one full bottle but increments numExchange by 1 after each exchange…
General practice
Simulate greedily watering plants left-to-right with a fixed-capacity can starting at the river: whenever remaining water can't fully cover the next plant you must walk…
General practice
Simulate two pointers from the ends moving inward, tracking each person's remaining water and incrementing a refill count whenever they must top up to fully…
General practice
Count the number of ways to write n as a sum of distinct positive integers raised to the x-th power (order irrelevant), returning the count…
General practice
Count how many indices you can remove from nums so that the remaining array has equal sums at even and odd indices. The core challenge…
General practice
Count the ways to split a binary array into contiguous subarrays each containing exactly one '1'. This equals the product, over each pair of consecutive…
General practice
Count the number of ways to choose two split indices to partition the array into three non-empty contiguous subarrays (left, mid, right) such that sum(left)…
General practice
Given a table of city-level weather observations (country, city, weather_type), compute a single weather type for each country by aggregating city reports — typically returning…
General practice
Simulate dropping each ball from the top of each column through an m×n grid of 1/-1 diagonal boards that steer it right/left; for each ball…
General practice
Given an integer array, find two (contiguous) ranges with equal sum such that the distance between their starting indices is maximized, and return that maximum…
General practice
Companies: Amazon, Turing
Array · Counting · Enumeration · Hash Table