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 4,251–4,275
Given an array of pile sizes and k operations each removing floor(pile/2) stones from a chosen pile (possibly the same pile multiple times), minimize the…
Companies: Salesforce
Array · Greedy · Heap (Priority Queue)
Remove all trailing '0' digits from a numeric string and return the resulting integer as a string (i.e., trim the '0' suffix). Input length ≤1000…
General practice
Given a string, remove all vowel characters (a, e, i, o, u — typically case-insensitive) and return the remaining characters in their original order. This…
General practice
General practice
Given an array of positive integers (bag counts), remove beans (only deletions allowed) so that every non-empty bag has the same count, minimizing total beans…
Companies: D. E. Shaw
Array · Enumeration · Greedy · Prefix Sum
Given a string where each '*' deletes the nearest preceding non-star character (and the '*' itself), return the resulting string after all deletions. The core…
General practice
Rename the columns of the students table according to the mapping id→student_id, first→first_name, last→last_name, and age→age_in_years, returning the same rows with updated…
General practice
Partition logs into letter-logs and digit-logs, then return all letter-logs first sorted lexicographically by their contents (using identifier as a tie-breaker) followed by the…
General practice
Given a tree of n nodes with one-way roads, compute the minimum number of edge reversals needed so that every city can reach city 0…
General practice
Determine whether any permutation of n's digits (not allowing a leading zero) can form a power of two. The core task is to check if…
General practice
Given a string s and an integer n, return the string formed by concatenating s to itself n times; handle edge cases like n ≤…
General practice
Find the minimum number of times string a must be concatenated with itself so that b appears as a contiguous substring of the result, or…
General practice
Check whether a string can be formed by repeating a smaller substring multiple times — i.e., whether it has a non‑trivial period. Constraint: 1 ≤…
General practice
Replace each '?' in a lowercase string with a lowercase letter so that no two adjacent characters are equal, without changing the given letters. The…
General practice
Given a string with lowercase letters at even indices and digits at odd indices, replace each digit by shifting the preceding letter forward by the…
General practice
Given an array of distinct integers and a sequence of operations that replace a specified existing value with a new unique value, apply all replacements…
General practice
Replace each element in the array with the greatest element among those to its right (and set the last element to -1). This is typically…
General practice
Given two tables mapping employee id→name and id→unique_id, produce a list of all employees showing their unique_id (or NULL if no mapping exists); this is…
General practice
Repeatedly scan the array and whenever two adjacent numbers have GCD>1 replace them with their LCM, continuing until no adjacent non-coprime pairs remain; return the…
General practice
Given a string s with '?' wildcards, replace each '?' by a lowercase letter to minimize the total "value" — defined as the sum over…
General practice
Given a string of only 'Q','W','E','R', find the minimum-length substring that can be replaced so each character appears exactly n/4 times. This reduces to finding…
General practice
Given a table/list of report dates (often per user or entity), group consecutive calendar days into contiguous runs and output each run's start and end…
General practice