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,226–4,250
Remove non-digit characters from the input string and then split the digits into groups of three from left to right, adjusting the final groups so…
General practice
Rearrange an alphanumeric string so letters and digits strictly alternate (no two adjacent characters of the same type) and return any valid permutation or an…
General practice
Given an n×n grid where each cell contains '/', '\' or a blank that splits the square, determine how many connected regions are formed by…
General practice
Given an array of unique scores, rank athletes by descending score and return an array where each original i-th athlete's rank is "Gold Medal", "Silver…
General practice
Reorder arr1 so its elements follow the relative order given by arr2 (keeping duplicates together), and place elements not in arr2 at the end in…
General practice
Given a (large) integer n, compute the n-th positive integer in the sequence formed by removing all numbers that contain the digit '9' — a…
General practice
Given a lowercase string, find the minimum number of single-character edits so that no adjacent characters are "almost-equal" (equal or consecutive letters in the alphabet)…
General practice
Given s and part, repeatedly remove the leftmost occurrence of part from s until no more occurrences remain, and return the resulting string. The core…
General practice
Given a binary matrix, determine whether you can make every cell 0 by toggling any subset of whole rows and columns (flipping 0↔1). This is…
General practice
Given a binary matrix and the ability to toggle entire rows or columns, determine whether you can turn every entry to 0 (and, if required…
General practice
Given an array of colored boxes where removing a contiguous group of k identical boxes yields k^2 points, compute the maximum score by choosing removals…
General practice
Two players alternately delete a non-edge piece whose neighbors are the same color (Alice deletes 'A', Bob deletes 'B'); determine if Alice wins under optimal…
General practice
Given an array of source-code lines, strip C++ line ("//") and block ("/* ... */") comments and return the remaining non-empty lines in order. Block…
General practice
Remove duplicate letters from s so each character appears exactly once and the resulting string is the smallest possible in lexicographic order. This is solved…
Companies: TikTok
Greedy · Monotonic Stack · Stack · String
Given an array and a value val, remove all occurrences of val in-place and return k such that the first k elements of the array…
General practice
Companies: Bloomberg, Deloitte
Simulation · Stack · String
Given a lowercase string, determine whether removing exactly one character can make the frequencies of all remaining letters equal. In other words, check if the…
General practice
Given an undirected graph with edges usable by Alice-only, Bob-only, or both, compute the maximum number of edges you can remove while still allowing both…
General practice
Given a directed graph of method invocations, identify all methods reachable from k (suspicious); if no edge from any node outside that reachable set points…
General practice
Check whether the array can be made strictly increasing by removing at most one element (return true if already strictly increasing) — i.e., detect at…
General practice
Given a valid parentheses string, decompose it into primitive valid substrings and return the string formed by removing the outermost '(' and ')' of each…
General practice
Given a string s containing only 'a' and 'b', find the minimum number of palindromic subsequence removals (subsequences need not be contiguous) required to delete…
General practice