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,751–2,775
Companies: Databricks
Implement an iterator that, given a sorted string of distinct lowercase letters and an integer k, returns all length-k combinations in lexicographic order via next()…
General practice
Count how many characters in the string stones are also listed in the string jewels (case‑sensitive). The core task is efficient membership testing—treat jewels as…
General practice
Merge two arrays of objects by their integer id into a sorted array of unique ids, combining objects with the same id via a shallow…
General practice
Find the minimum number of jumps to reach the last index from index 0 in an array where from index i you may move to…
General practice
Given an array where you may jump right only to strictly smaller elements and left only to strictly larger ones, compute for each index the…
General practice
Given an array and max distance d, you may jump from i to j (|i-j|<=d) only if arr[j] < arr[i] and every element between i…
General practice
Find the maximum sum you can collect jumping from index 0 to n-1 when each move can advance at most k steps; this reduces to…
General practice
Given a binary string s and integers minJump and maxJump, determine whether you can reach the last index from index 0 by repeatedly jumping from…
General practice
Given a sequence and constrained jump rules (e.g., you may jump only within a distance range or according to element values, and some positions may…
General practice
Count the number of distinct contiguous subarrays of nums that contain at most k elements divisible by p. The core challenge is to enumerate and…
General practice
Given an array where flowers[i] is the position that blooms on day i+1, find the earliest day when there exist two bloomed flowers with exactly…
General practice
Run a BFS from the start to get shortest-path distances to reachable cells (0 = wall), collect cells whose value is within [low, high], and…
General practice
Count how many permutations of 1..n have exactly k inverse pairs (inversions). This is a combinatorics/DP counting problem (answer mod 1e9+7) with n,k up to…
General practice
Given counts of items worth 1, 0, and -1, pick exactly k items to maximize the total sum — effectively take as many 1s as…
General practice
For each index i, compute the integer average of the subarray nums[i-k..i+k] (window size 2k+1) or -1 if the window goes out of bounds. The…
General practice
Find the maximum subarray sum in the array obtained by repeating arr k times (empty subarray allowed, return 0) and output the result modulo 1e9+7…
General practice
Count the number of unique unordered pairs (x, y) from the array whose absolute difference is k. Handle k>0 by checking distinct values x for…
General practice
Given two anagram strings (length ≤ 20), find the minimum number of arbitrary swaps of characters in s1 needed to transform it into s2 —…
General practice
Find all subtree sizes that form perfect binary trees (every internal node has two children and all leaves are at the same depth) in a…
General practice
Given a stream of point insertions on an infinite plane, after each insertion return the k-th smallest Manhattan distance (|x|+|y|) from the origin or -1…
General practice