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,251–1,275
Find the length of the longest pair of perfect anagrams from the substrings of a given string. Perfect anagrams are defined as words with equal…
Companies: Amazon
Last reported Oct 2024
Given an array of positive numbers and a capacity c, find the minimum number of boxes to unload so that the maximum value in the…
Companies: Amazon
Last reported Oct 2024
Find the most frequently occurring letter in a string of uppercase letters arranged in alphabetical order.
Companies: Google
Last reported Oct 2024
Given a rectangular grid with exactly one island of orthogonally connected land cells, compute the island's perimeter by summing the edges of land cells that…
Companies: Google
Last reported Oct 2024
Find the sum of all nodes in a binary tree.
Companies: Google
Last reported Oct 2024
Given a binary tree with costs associated with each edge, find the minimum cost to disconnect all leaf nodes by cutting edges.
Companies: Google
Last reported Oct 2024
Given a numeric string and a target digit that occurs at least once, remove exactly one occurrence of that digit so the remaining string represents…
Companies: Google
Last reported Oct 2024
Find all possible ordered sequences (compositions) that sum to a given target number using only the values 1 and 2.
Companies: Google
Last reported Oct 2024
Given a string and allowed index swap pairs, view pairs as edges in a graph to find connected components where characters can be freely permuted…
Companies: Goldman Sachs, Google
Array · Breadth-First Search · Depth-First Search · Hash Table
Last reported Oct 2024
Solve the 0/1 Knapsack problem with focus on time complexity optimization.
Companies: Google
Last reported Sep 2024
Given two binary trees, merge them into a new tree by traversing both from the roots and summing the values of overlapping nodes while using…
Companies: Google
Last reported Sep 2024
Given a file where each line contains a timestamp and a speaker's utterance, count the total number of words spoken by each individual in the…
Companies: Google
Last reported Sep 2024
Find the shortest string over digits 0..k-1 such that every possible length-n password appears as a contiguous substring (i.e., produce a de Bruijn sequence of…
Companies: Google
Last reported Sep 2024
Place k mailboxes on a line to minimize the sum of distances from each house to its nearest mailbox; optimal placement partitions the sorted houses…
Companies: Amazon
Last reported Sep 2024
Given a binary tree, convert it so that every parent node holds the logical AND of its children's values. Leaf nodes may be edited as…
Companies: Meta
Last reported Sep 2024
Given an unsorted array of numbers, return an array where each element is replaced with the index it would have in a sorted array. Example…
Companies: Amazon
Last reported Sep 2024
Determine whether two strings containing letters and '#' (backspace) produce the same final text after applying backspaces. The core challenge is correctly handling deletions…
Companies: Amazon
Last reported Sep 2024
Given a 2D grid representing a farmland where 1 denotes a defender and 0 denotes a farmer, find the position of the most vulnerable farmer…
Companies: Amazon
Last reported Sep 2024
Given an m×n crossword grid of letters, blanks, and blocks, determine whether a target word can fit into any horizontal or vertical slot (in any…
Companies: Amazon, Google
Last reported Sep 2024
Pick exactly k elements from an array to maximize their sum under the constraint that the sum must be even. Typical approach is greedy: take…
Companies: Google
Last reported Sep 2024
Determine whether you can reduce all elements of nums to zero by repeatedly subtracting 1 from any contiguous subarray of length k. The core challenge…
Companies: Google
Last reported Sep 2024
Maintain dynamic collections to (1) return the cheapest up-to-5 shops that have an unrented copy of a given movie and (2) report the cheapest up-to-5…
Companies: Amazon, Okta
Array · Design · Hash Table · Heap (Priority Queue)
Last reported Sep 2024
Create a web application using React to fetch and display GDP data from a public API. The application should allow users to view GDP data…
Companies: Apple
Last reported Sep 2024
Given a circular street represented by an array of houses, count how many houses satisfy a local property that depends on their neighbors (e.g., empty/available…
Companies: Apple
Last reported Sep 2024
Find employees with the highest salary in each department by grouping employees by department, computing the max salary per group, and selecting all employees whose…
Companies: Apple
Last reported Sep 2024