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 2,576–2,600
Given a circular string ring and a target key, find the minimum steps to spell key by repeatedly rotating the ring (cost = minimal circular…
General practice
Given a set of 2-letter words (bigrams) over ≤16 distinct letters, each bigram imposes a precedence constraint (a must appear before b) and the task…
General practice
Design a data structure that supports add(number), deleteOne(number), and hasFrequency(f) queries—returning whether any value currently appears exactly f times—under up to 2e5…
General practice
Given item prices and a repeating weekly schedule where purchases made on Fridays trigger special discounts or coupons, optimize which items to buy (and when)…
General practice
Given a list of item prices and a budget, determine the maximum number of purchases you can make across successive Fridays under a repeating weekly…
General practice
Schedule purchases across recurring Fridays with special discounts or carryover coupons and constraints (budget, limited uses, or item availability) so as to minimize total…
General practice
Given a set of users (typically with an attribute like age) and a deterministic rule that decides whether a friend request from user A to…
General practice
Given a table of accepted friend requests (each row representing a bidirectional friendship between requester_id and accepter_id), count each user's distinct friends by…
General practice
Given user/friendship and streaming records, return the distinct movies that a user's friends streamed during the previous month — requiring joins between friendship and stream…
General practice
Given an undirected friendship graph (list of friend pairs), identify/count the friend pairs that share no mutual friends — i.e., their neighbor sets are disjoint…
General practice
Given sorted stone positions on a line, find the minimum possible maximum jump length for a frog that must go from the first stone to…
General practice
Given an array of fruit types where you can pick from a contiguous sequence while carrying at most two distinct types (two baskets), return the…
Companies: Adobe, Amazon, Meta, Salesforce
Array · Hash Table · Sliding Window
Assign each fruit, left-to-right, to the leftmost unused basket whose capacity is at least the fruit's quantity (each basket holds one fruit type); return how…
General practice
Given an array of unary integer functions, return a single function that composes them right-to-left (i.e., f(g(h(x)))) and applies to an integer input; if the…
General practice
Given a sequence of moves on a number line where 'L' and 'R' are fixed steps and '_' can be chosen as either left or…
General practice
Given several piles of stones and rules for how many stones can be removed each turn, determine whether the first player can force a win…
General practice
Given an Activity table of player logins, return each player’s earliest event_date as their first_login. This is solved by grouping by player_id and taking the…
General practice
Given a game-play log table, write an SQL query to identify players and dates that meet a simple activity condition (for example, players who played…
General practice
Given a gameplay events table recording player, level, and result, write an SQL query to identify players with failure/success patterns (e.g., players who failed at…
General practice
Find each player's earliest login date, check whether they have a record on that date plus one day, and return the fraction of players who…
General practice
Given a table of game-play events (user_id, event_date), identify users who match a specified complex temporal play pattern (e.g., consecutive-day streaks or retention…
General practice
Find the GCD of the sum of the first n odd numbers and the sum of the first n even numbers. Use the arithmetic-series identities…
General practice
Determine whether an array can be sorted using only swaps between elements whose gcd is >1 — equivalently, check if each number can be moved…
General practice
Companies: Databricks