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,351–4,375
Determine whether you can choose k non-overlapping substrings (none equal to the whole string) such that every character inside each chosen substring does not appear…
General practice
Given a sequence of step lengths taken in repeating north, west, south, east directions (counterclockwise), determine whether the resulting axis-aligned polyline ever…
General practice
Generate all numbers in [left, right] whose nonzero digits each divide the number itself; for each candidate, iterate its digits, reject if any digit is…
General practice
Companies: Stripe
Given inventories where each sale of a color yields value equal to its current count and reduces that count by one, choose which balls to…
Companies: Goldman Sachs
Array · Binary Search · Greedy · Heap (Priority Queue)
Given seller and sales tables, return the sellers who have no matching sales records (i.e., never made a sale). This is an SQL anti-join/NOT EXISTS…
General practice
Given a permutation, find the minimum number of adjacent swaps to make it "semi-ordered" (1 at index 0 and n at index n-1) — equivalently…
General practice
Given a list of words and screen dimensions (rows × cols), determine how many times the full sentence can be placed on the screen by…
General practice
Given two sentences and a list of similar word pairs, determine if they are sentence-wise similar: they must have the same length and for each…
General practice
Determine whether one sentence can be turned into the other by inserting a single contiguous (possibly empty) sequence of words, i.e., check if the two…
General practice
Given a binary string, find the minimum number of adjacent swaps needed to move all 1s to the right (0s to the left); this equals…
General practice
Flatten an array of positive integers into a single array containing each integer's decimal digits in the same order (both across numbers and within each…
General practice
Find all integers whose digits are consecutive increasing digits (each digit = previous + 1) and return the sorted list of those within the inclusive…
Companies: Zoho
Enumeration
Given an m×n grid with some cells that must be visited in a specific adjacency-based sequence, find the minimum number of vertex-disjoint paths that together…
General practice
Maintain a dynamic set of uniquely-named locations ordered by score (descending) and name (ascending), supporting insertions and answering the i-th best location on the i-th…
General practice
Given start/stop timestamps for jobs across servers, compute the total time the system was busy (the union of all active intervals). This requires sorting and…
General practice
Companies: Databricks
Find the minimum-size set of integers such that every given interval contains at least two numbers from that set. This is a greedy interval-cover variant…
General practice
Given an array of length n containing numbers from 1 to n where one value was duplicated and another lost, return [duplicate, missing]. Core challenge…
General practice
Cyclically shift an m x n matrix right by k positions where each element moves to the next column and wraps row-wise (last element goes…
General practice
Given s and t, compute the minimum total cost to transform each character of s into the corresponding character of t by rotating letters on…
General practice
Given a lowercase string s and an array shifts where shifts[i] means add shifts[i] circular shifts to the first i+1 letters, compute the final string…
General practice
Given a string s and many range shift operations (each shifting all characters in [start,end] forward or backward by 1), compute the final string after…
General practice
Companies: Databricks
Given a list of words, compute the minimum length of a '#'‑terminated reference string that encodes them by noting you can omit any word that…
General practice