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,426–2,450
Given a tree and a marking process (e.g., initial marked nodes or rules for mark propagation along edges), determine which nodes become marked last; the…
General practice
Count the occurrences of each decimal digit in the integer n and return the digit with the smallest frequency; if multiple digits are tied, return…
General practice
Given a binary tree, compute the sum of node values at each depth and return the level index that has the minimum sum (if multiple…
General practice
Given a string and integer k, consider every way to split the string into k non‑empty contiguous parts; among all parts across all splits, return…
General practice
Given a string of letters and a limited set of operations that move letters from the "box" to an output (with the ability to defer…
General practice
Find an increasing sequence of indices in word1 of length |word2| such that the characters at those indices form a string that differs from word2…
General practice
Find the longest contiguous substring of the form 0^k1^k (k zeroes immediately followed by k ones) — i.e., zeros before ones and equal counts —…
General practice
Given an array and at most k deletions, find the maximum length of a contiguous subarray that can be made constant (all equal) after removing…
General practice
Given a digit string, return the length of the longest contiguous substring that contains at most one adjacent equal pair (i.e., no more than one…
General practice
For each index i, compute the length of the longest non-decreasing subsequence (in original order and including i) that ends at i. With n up…
General practice
Starting from friend 1, repeatedly advance i*k positions clockwise (mod n) on the i-th move, track visited friends until some friend is visited twice, and…
General practice
Find the largest integer x that can be transformed into num in at most t operations, where each operation independently increments or decrements both x…
General practice
Given arrays nums and divisors, compute for each divisor how many nums are divisible by it and return the divisor with the highest count (breaking…
General practice
Given an array of small positive integers (n ≤ 100, nums[i] ≤ 30), remove at most one element to maximize the product of the GCD…
General practice
Find the longest subsequence (order preserved) of nums that has at most k adjacent unequal pairs (i.e., at most k transitions between different values). This…
General practice
Find the longest subsequence of nums that has at most k adjacent changes (i.e., at most k indices i with seq[i] != seq[i+1], equivalently at…
General practice
Find the maximum-length subsequence whose adjacent sums all have the same parity — equivalently either all elements have the same parity or the subsequence strictly…
General practice
Find the longest subsequence (order preserved) of nums such that every adjacent pair sum has the same remainder modulo k. This reduces to a DP/greedy…
General practice
Find the largest subset of nums that can be arranged as a palindrome of successive squarings of some base x — i.e., values equal to…
General practice
Three players start at three corners of an n×n grid and each make exactly n−1 constrained moves to reach (n−1,n−1), collecting fruits in visited cells…
General practice
Given an integer array, repeatedly pair up distinct unmarked indices (i, j) with 2 * nums[i] <= nums[j] and mark both; return the maximum number…
General practice
Pick a subsequence of length 2k (preserving order) and split it into the first k and last k elements to maximize (OR of the first…
General practice
Given a tree where performing an operation on an edge XORs both endpoint node values by k, determine the maximum total node sum achievable by…
General practice
Find the median of the multiset formed by the number of distinct elements in every subarray of nums — i.e., determine the k-th smallest value…
General practice