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,976–3,000
Given a string, find the length of the longest contiguous substring that contains at most two distinct characters — a sliding-window / two-pointer problem where…
General practice
Given a sequence of pass events between players, find the maximum-length streak of consecutive passes that stays within a single team (respecting chronological/timing and…
General practice
Find the length of the longest contiguous subarray where the sign of each adjacent comparison strictly alternates (i.e., > then < then > ... or…
General practice
Return the length of the longest string that is a subsequence of exactly one of two given strings — if the strings are identical return…
General practice
Given an array words and a parallel binary array groups, find a longest subsequence (preserving original order) of words such that the corresponding group bits…
General practice
Find the longest increasing subsequence of indices such that each adjacent pair of selected words has the same length, Hamming distance 1, and comes from…
General practice
Given out-of-order uploads of videos numbered 1..n, design a data structure that tracks the largest k such that all videos 1..k have been uploaded. Support…
General practice
Given a chronological sequence of match outcomes (wins/losses/ties), find the maximum-length contiguous interval where wins outweigh losses (net positive score). This requires…
General practice
Find the longest word in the list such that every prefix (built left-to-right by adding one character) is also present in the list; if multiple…
General practice
Given a string s and a list of words, return the longest word that is a subsequence of s (i.e., can be formed by deleting…
General practice
Given a list of words, find the longest word such that every prefix of that word is also present in the list (break ties by…
General practice
Given a binary tree, return the length (number of edges) of the longest path that alternates left and right at each step (a ZigZag), starting…
General practice
Given an acyclic directed graph of richer->poorer relations and a quietness score per person, compute for each person the quietest person among all people who…
Companies: Flipkart
Array · Depth-First Search · Directed Acyclic Graph · Graph Theory
Given a list of problems each annotated with a quality metric (score, flag, or tag) and a definition of "low-quality" (e.g., below a threshold or…
General practice
Given a binary tree and a list of target nodes, find the lowest common ancestor — the deepest node whose subtree contains all the targets…
General practice
Find the node that is the lowest common ancestor of all leaves at the maximum depth in a binary tree — equivalently, the root of…
General practice
Given an m×n matrix of distinct numbers, return all "lucky" elements that are the minimum in their row and simultaneously the maximum in their column…
General practice
Count how many 3x3 subgrids of the given grid are magic squares — i.e., each contains the digits 1 through 9 exactly once and every…
General practice
Generate the infinite self-referential binary sequence s (starting "122112...") whose run lengths equal the sequence itself, and return how many '1's appear in the first…
General practice
Given n basket positions and m balls, place the balls to maximize the minimum pairwise distance (magnetic force) between any two balls. This is the…
General practice
Companies: LinkedIn
Find all elements in an integer array that appear more than ⌊n/3⌋ times (there can be at most two such elements). The challenge is to…
General practice
Given an integer array and a defined operation that modifies elements (e.g., increment/decrement single elements or apply transfers over ranges), transform the array so every…
General practice