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 1,201–1,225
Given a file containing a list of usernames and the text of a Shakespeare book, find and return the usernames that appear in the book.
Companies: Google
Last reported Nov 2024
Given two equal-length strings of only 'x' and 'y', compute the minimum number of swaps between the strings (swap s1[i] with s2[j]) to make them…
Companies: Google
Last reported Nov 2024
Given a string, produce its shortest encoded form using the k[encoded_string] notation (allowing nested encodings) by replacing repeated substrings with counts. The core…
Companies: Amazon
Last reported Nov 2024
Given a list of time intervals representing employee shifts, identify overlapping shift pairs or the actual overlapping time segments; the core challenge is detecting interval…
Companies: Google
Last reported Nov 2024
Given a sorted array, remove duplicates in-place so that each distinct value appears at most twice and return the new length k, preserving relative order…
Companies: Amazon
Last reported Nov 2024
Two-player zero-sum game on an even-length array where players alternately take an entire pile from either end; determine whether the first player can force a…
Companies: Google
Last reported Nov 2024
Given a numeric string, remove exactly k digits (preserving the remaining order) to form the smallest possible integer, trimming leading zeros and returning "0" if…
Companies: Amazon
Last reported Nov 2024
Count how many contiguous subarrays of length at least three form an arithmetic sequence (i.e., have the same difference between consecutive elements). The task reduces…
Companies: Google
Last reported Nov 2024
You must find the minimum number of moves from a starting cell to a target in a 2D grid that is initially unknown and can…
Companies: Airbnb
Last reported Nov 2024
Find the longest contiguous substring that appears at least twice (overlaps allowed) in a given lowercase string, or return "" if none exists. With n…
Companies: Amazon
Last reported Nov 2024
Determine whether by selecting any subset of positions in str1 and incrementing each chosen character once cyclically (a→b→...→z→a) you can make str2 a subsequence of…
Companies: Amazon
Last reported Nov 2024
Given positions of existing gas stations and a budget k of new stations to add, place the k stations to minimize the maximum distance between…
Companies: Amazon
Last reported Nov 2024
Find all pairs of distinct integers that achieve the minimum absolute difference; the typical approach is to sort the array and collect adjacent pairs with…
Companies: Amazon, Walmart Labs
Array · Sorting
Last reported Nov 2024
Given n stones on integer coordinates where a stone can be removed if it shares a row or column with another, compute the maximum number…
Companies: Amazon
Last reported Nov 2024
Given a directed functional graph (each node has exactly one outgoing edge via edges[i]), compute each node's "edge score" as the sum of labels of…
Companies: Amazon
Last reported Nov 2024
Given an array of distinct integers, find the minimum number of deletions from the front or back needed to remove both the array's minimum and…
Companies: Amazon
Last reported Nov 2024
Find the maximum sum of unique node values collectible by any walk that starts and ends at node 0 within a given time budget on…
Companies: Amazon, Nutanix
Array · Backtracking · Graph Theory
Last reported Nov 2024
Given an array of frequencies where freq[i] is the count of value i (counts may be large), compute the median of the implicit multiset without…
Companies: Amazon
Last reported Nov 2024
Count how many starting indices can reach the end of an array by alternating odd/even jumps where an odd jump goes to the smallest-index j>i…
Companies: Google
Last reported Nov 2024
Evaluate the integer value of an expression given in Reverse Polish Notation, where tokens are integers or the operators +, -, *, / and all…
Companies: Citadel, Google
Array · Math · Stack
Last reported Nov 2024
Companies: Databricks
Last reported Nov 2024
Design a file system that supports folders and files, where a single file can exist in multiple folders and folder structures may contain cycles. Implement…
Companies: Google
Last reported Oct 2024
Given a list of floating point numbers representing items and a distance d, group the items into triplets where all items in a triplet are…
Companies: Google
Last reported Oct 2024
Reorder an array of values 0, 1, and 2 in-place so all 0s come first, then 1s, then 2s (the Dutch National Flag problem); aim…
Companies: Amazon, Google, Microsoft, Walmart Labs
Array · Bubble Sort · Quicksort · Sorting
Last reported Oct 2024
Compute each element's remainder mod 3 and for each add the minimum moves to reach 0 (min(r, 3−r)), which reduces here to counting all elements…
Companies: Google
Last reported Oct 2024