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,476–2,500
Given a final string produced when Alice may have long-pressed at most one key (extending a single run of identical characters), count how many original…
General practice
Count how many original strings (of length at least k) could have produced the given final word if each intended character may have been long-pressed…
General practice
Find all indices (excluding the first and last) in the array mountain where the element is strictly greater than both neighbors. Return those peak indices…
General practice
Find an integer x in [1..n] such that the sum of 1..x equals the sum of x..n; return x or -1 if none exists. Use…
General practice
For each k-length subarray, determine whether its elements form a strictly increasing consecutive sequence (each element = previous + 1); if so return its maximum…
General practice
For each size-k sliding window, check whether the k elements form an ascending sequence of consecutive integers (i.e., each adjacent difference is 1); return the…
General practice
Given two permutations A and B of 1..n, produce array C where C[i] is the number of values that appear in both prefixes A[0..i] and…
General practice
Sum the squares i^2 for all i in [1..n] such that the decimal digits of i^2 can be partitioned into contiguous substrings whose integer values…
General practice
Given m exam rankings/scores for the same n students, identify all students who are "quiet" — i.e., for every other student j there exists at…
General practice
For each prefix nums[0..i], compute the score defined as the sum over j<=i of (nums[j] + max(nums[0..j])); the core task is to output these scores…
General practice
Given a target string and a keyboard with only two operations (append "a" or cyclically increment the last character), simulate the minimal-key-press sequence that produces…
General practice
Given up to 12 unique words, produce the shortest string that contains each word as a substring by choosing an ordering that maximizes pairwise overlaps—an…
General practice
Given a list of strings, find the shortest string that contains every input string as a substring by ordering and overlapping them optimally. The core…
General practice
Find the minimum positive integer divisor d such that the sum of ceil(nums[i]/d) over all elements is ≤ threshold. The sum is monotone decreasing in…
General practice
Reconstruct the lexicographically smallest length-n lowercase string whose suffix-pair longest-common-prefix lengths match the given n×n lcp matrix, or return an empty string…
General practice
Given an array of chalk usage per student cycled repeatedly and k chalk pieces, find the index of the first student whose required chalk is…
General practice
Map each character in s to an integer value (use vals when the char appears in chars, otherwise its 1-indexed alphabet position). Then find the…
General practice
Given a directed hierarchy/DAG of tasks and their subtasks and a log of executed subtask IDs, identify which subtasks were never executed (including those unreachable…
General practice
Given an array of positive integers, for each number replace every digit with the largest digit present in that number (e.g., 523 -> 555) and…
General practice
Compute the sum (mod 1e9+7) of the "power" of every k-element subsequence of nums, where a subsequence's power is the minimum absolute difference between any…
General practice
Compute the total "power" defined as the sum, over all subsequences S of nums, of how many sub-subsequences of S have sum equal to k…
General practice
Given n people and a list of pairwise associations indicating who is on the same team, compute the size of the connected component (e.g., the…
General practice
Given directed trust relationships among n people, identify the person who is trusted by everyone else but trusts nobody — equivalently, find a node with…
General practice