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,326–2,350
Find the length of the longest substring of a digit string that can be rearranged into a palindrome (i.e., at most one digit has an…
General practice
Given a list of call records (caller, callee, start/end times or durations), identify the call(s) or user(s) with the longest duration or highest total call…
General practice
Find the maximum length L such that a substring made of a single repeated character (a "special" string like "aaa") appears at least three times…
General practice
Find the maximum length L of a "special" substring (a contiguous run of a single repeated character) that appears at least three times in s…
General practice
Group transactions by customer and select those whose activity spans at least 30 days, have made at least 3 "purchase" transactions, and whose refund rate…
General practice
Compute the frequency of each value in the array and return the largest integer whose frequency equals its value (a "lucky" integer); return -1 if…
General practice
Given n points, return twice the maximum area of any triangle whose at least one side is axis-parallel (or -1 if none); this reduces to…
General practice
Given a positive-integer array where you may replace any contiguous subarray by its sum, find the maximum number of contiguous segments you can partition the…
General practice
Given a string, pick the maximum number of non-overlapping substrings of length at least 4 whose first and last characters are the same — effectively…
General practice
Given an array of distinct two-letter strings, compute the maximum number of disjoint pairs (i < j) such that one string equals the reverse of…
General practice
Given a source string, a pattern that is a subsequence of source, and a sorted list of removable indices, find the maximum number of characters…
General practice
Companies: Amazon, Samsung
Array · Greedy
Given an array where at each step you may remove any two elements from the first three (or if <3 remain, remove all) with cost…
General practice
Given two logs of lengths n and m and three trucks each with capacity k, minimize the total cost of cutting the logs (splitting x…
General practice
Partition a list of indivisible jobs (each with a duration) among a fixed number of workers to minimize the maximum workload (makespan) any worker gets…
General practice
Given an n×m grid where each cell has the earliest time it can be entered and moving to an adjacent cell takes exactly 1 second…
General practice
Find the minimum time to reach the bottom-right cell in an n×m grid from (0,0) when each cell has a minimum allowed time you can…
General practice
Scan the string left-to-right and greedily pair each character with the nearest earlier unmarked index whose character is its alphabet mirror (a↔z, b↔y, ...), marking…
General practice
Given an n×n grid containing numbers from 1 to n^2 where exactly one number appears twice and one number is missing, identify and return the…
General practice
Companies: Amazon, Bloomberg, Google, Meta +1
Array · Hash Table · Sorting
Given m observed 6-sided die rolls and a target mean for n+m rolls, determine whether the n missing rolls can sum to the required total…
General practice
Given a BST that may contain duplicate values, return all value(s) that occur most frequently (the mode(s)) in the tree. The key insight is that…
General practice
Count letter frequencies in the string, separately track vowels (a,e,i,o,u) and consonants, then return the sum of the maximum vowel frequency and the maximum consonant…
General practice