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,051–4,075
Given a permutation of 1..n, sort the array using pancake flips that reverse a prefix arr[0..k-1] and return a sequence of k-values that produce a…
General practice
Given n ≤ 15 courses with prerequisite relations forming a DAG, schedule up to k courses per semester (only if their prerequisites are already taken)…
General practice
Given an array of asynchronous tasks, execute them in parallel and provide a way to retrieve each task's result individually as soon as it settles…
General practice
Implement a partial-application helper that takes a function and an initial argument list containing special placeholders, and returns a callable that fills those placeholders…
General practice
Partition the array into three contiguous groups — elements < pivot, elements == pivot, and elements > pivot — while preserving the original relative order…
General practice
Partition the array into contiguous subarrays of length at most k, replace every value in a subarray with that subarray's maximum, and maximize the resulting…
Companies: TikTok
Array · Dynamic Programming
Partition the array (n ≤ 19) into three disjoint subsequences to maximize XOR(A) + AND(B) + XOR(C); because n is small this is solved by…
General practice
Partition the array into two non-empty contiguous subarrays left and right so that every element in left <= every element in right, and left has…
General practice
Determine whether the array can be partitioned into n/k groups of size k (using every element exactly once) such that each group contains only distinct…
General practice
Determine whether an integer array can be split into three non-empty contiguous parts whose sums are equal. Key insight: the total sum must be divisible…
General practice
Partition the 2n integers into two equal-sized groups (choose n elements for one group) to minimize the absolute difference of their sums — a constrained…
Companies: Salesforce
Array · Binary Search · Bit Manipulation · Bitmask
Check whether the array can be partitioned into two non-empty disjoint subsets whose element-products both equal target — equivalently verify product(nums) == target^2 and that…
General practice
Partition the array into the minimum number of subsequences (each element used exactly once) so that in every subsequence the difference between its maximum and…
General practice
Partition the array into k non-empty contiguous subarrays so the maximum of each subarray's bitwise XOR is as small as possible; the core challenge is…
General practice
Partition the input string greedily into contiguous segments by extending the current substring until that substring has not appeared before, then mark it seen and…
General practice
Partition a binary string into the minimum number of contiguous substrings such that each substring has no leading zeros and its binary value is a…
General practice
Partition the digit string s into the fewest contiguous substrings such that the integer value of each substring is <= k (return -1 if impossible)…
General practice
Given a decimal string n, find the minimum count of positive deci-binary numbers (digits only 0 or 1, no leading zeros) whose sum equals n…
General practice
Generate the first numRows of Pascal's Triangle as a list of lists, where each row starts and ends with 1 and every interior element equals…
Companies: Bloomberg
Array · Dynamic Programming
Return the 0-indexed rowIndex row of Pascal's triangle (i.e., the binomial coefficients C(rowIndex, k) for k=0..rowIndex). The core challenge is computing those coefficients…
General practice
People stand in a line from 1 to n and pass a pillow one step per second, reversing direction at the ends; given n and…
General practice
Given a sorted array of positive integers and a target n, find the minimum number of numbers to add so every value in [1, n]…
General practice
Given a sequence of unit moves (N/S/E/W) on a 2D grid, determine whether the walk ever visits the same coordinate twice. The core task is…
General practice