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,876–2,900
Given a lowercase string, return the length of the longest substring where each character is the immediate successor of the previous (i.e., consecutive letters like…
General practice
Given n distinct 2D points and an index k, find the maximum length of a strictly increasing sequence by both x and y that contains…
General practice
Find the length of the longest contiguous substring of word that does not contain any string from forbidden as a substring; forbidden strings are short…
General practice
Generate all strings formed by independently toggling the case of each alphabetic character in s (digits remain unchanged). This is an exponential enumeration problem (up…
General practice
Given up to 7 letter tiles (with possible duplicates), count how many distinct non-empty sequences you can form using each tile at most once. The…
General practice
Generate the integers from 1 to n in lexicographical (dictionary) order under O(n) time and O(1) extra space; the core challenge is to traverse the…
General practice
Companies: Media.net
Array · Bit Manipulation · Greedy
General practice
Companies: Amazon, BNY Mellon, InMobi, Tekion
Array · Greedy · Hash Table · Queue
Given a string of lowercase letters and '*' where each operation deletes the leftmost '*' and the lexicographically smallest non-'*' character to its left, compute…
General practice
Given pairwise equivalences between characters in s1 and s2, compute character equivalence classes (e.g., with union-find) and replace each letter in baseStr with the smallest…
General practice
Build the lexicographically smallest string of length n+m-1 such that for each i, the length-m window at i equals str2 if str1[i]=='T' and differs from…
General practice
Companies: Amazon
Array · Greedy · Math · Sorting
Given a lowercase string, make the minimum number of character replacements to turn it into a palindrome and, among all such minimal-change palindromes, return the…
General practice
Companies: Google
Enumeration · String · Two Pointers
Companies: Amazon, Google
Counting · Enumeration · Greedy · Hash Table
Given a string of digits, you may perform at most one swap of adjacent digits that share the same parity (both even or both odd)…
General practice
Given a lowercase string, you may repeatedly delete any adjacent pair of letters that are consecutive in the cyclic alphabet (including 'a'↔'z'), with the string…
General practice
Given an even-length digit string, repeatedly apply two operations—add a (mod 10) to digits at odd indices and rotate the string right by b—to produce…
General practice
Companies: Meta, Paytm
Greedy · Hash Table · Monotonic Stack · Stack
Given a string s and a budget k, find the lexicographically smallest string t you can form by changing characters where each character change costs…
General practice
Given a lowercase string and the ability to perform exactly one operation that decrements every character in any chosen non-empty substring by one (with 'a'…
General practice
Compute the late fee for a returned library book by comparing return and due dates and applying tiered penalties (e.g., per-day, per-month, or flat for…
General practice