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 3,026–3,050
For each user, return their join_date and the number of orders they placed as a buyer in 2019. This requires filtering Orders to 2019, left-joining…
General practice
Given timestamped transaction or price records per market, identify markets/days that satisfy a short-term trend or anomaly pattern (e.g., consecutive-day increases or a…
General practice
Given a sequence of daily market prices, determine for each day whether a future day within a fixed window meets a specified price condition (e.g.…
General practice
Given a string that's either an email or a phone number, detect which it is and return a masked version: for emails, convert to lowercase…
General practice
Determine whether you can make sub equal to some contiguous substring of s by applying at most one single-step replacement (old -> new) to each…
General practice
Given an m×n matrix and integer k, compute for each cell the sum of all elements inside the (2k+1)×(2k+1) square centered at that cell, clipped…
General practice
Return all coordinates of an rows x cols grid sorted by increasing Manhattan distance from a given center cell — i.e., order every cell by…
General practice
Check whether performing k iterations of alternating cyclic row shifts (even-indexed rows left, odd-indexed rows right) returns the matrix to its original state; because each…
General practice
Partition a permutation of [0..n-1] into the maximum number of chunks such that sorting each chunk and concatenating yields the fully sorted array. The core…
General practice
Partition the array into the maximum number of contiguous chunks such that sorting each chunk individually and concatenating them yields the entire array sorted. Duplicates…
General practice
Given an integer, you may independently replace all occurrences of one digit with another (for each of two results) and must produce two valid non-zero…
General practice
Choose non-empty, equal-length subsequences (order preserved) from two arrays to maximize their dot product — the core challenge is optimally pairing or skipping elements when…
General practice
Given an n x n grid of building heights, increase building heights without changing the skyline seen from any cardinal direction (i.e., without altering any…
General practice
Group numbers by their largest decimal digit and for each digit take the two largest numbers to compute their sum; return the maximum such pair…
General practice
Given an array of positive integers, find the maximum sum of two distinct elements whose digit sums are equal; if no such pair exists return…
General practice
Find the maximum-sum subrectangle in an m×n matrix whose sum is no larger than k. The core challenge is reducing the 2D problem to many…
General practice
Given points sorted by x, find the maximum value of yi + yj + |xi - xj| for pairs with |xi - xj| ≤ k…
General practice
Given an undirected graph of n cities and roads, compute the maximum over all unordered city pairs of the total number of roads incident to…
General practice
For each element in an array, find the largest contiguous subarray (range) in which that element is the maximum. This is typically solved by locating…
General practice
Given a binary matrix, find the area of the largest axis-aligned rectangle containing only 1s. The key challenge is to efficiently compute this by treating…
General practice
Given an array nums and integer k, repeatedly pick an element to add to your score then replace it with ceil(val/3); maximize the total after…
General practice
Given a binary string (treated with implicit '1' at both ends), you may perform at most one trade that flips an internal contiguous run of…
General practice
For each query substring (augmented with a '1' at both ends), compute the maximum number of '1's obtainable by doing at most one "trade" that…
General practice
Companies: Google
Array · Greedy · Sorting · Union-Find
Given two exchange graphs (day1 and day2) with multiplicative rates (each edge is invertible), find the maximum amount of the starting currency obtainable by doing…
General practice