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,026–4,050
Online Assessment, was not like leetcode, more like having a project spec and having to design based on that, there are multiple parts that build…
Companies: Stripe
Given a time-ordered stream of votes, preprocess to record the leading candidate after each vote (breaking ties in favor of the most recent vote) and…
General practice
Preprocess an array to support up to 10^4 queries that ask whether any value appears at least threshold times in a subarray arr[left..right] (returning that…
General practice
Design a data structure for a rooted tree that supports lock(num,user), unlock(num,user) and upgrade(num,user) operations where lock/unlock enforce ownership, and upgrade locks…
General practice
Given an array of positive integers representing a chain of divisions, insert parentheses to maximize the evaluated value and return the resulting expression string. The…
General practice
Partition the lowercase string into the fewest contiguous substrings so that no substring contains a repeated character. With |s| up to 1e5, the core challenge…
General practice
Given a two-column table, generate results that order the rows independently by each column (i.e., produce one sequence sorted by column A and another sorted…
General practice
Given a string s and integer k where you may repeatedly take one of the first k characters and append it to the end, return…
General practice
Compute the maximum order quantity per entity (e.g., per customer or product) using grouping, then return those entities whose maximum quantity is greater than the…
General practice
Count the number of sequences of at most maxMove moves that take a ball from a start cell to outside an m×n grid by moving…
General practice
Given n (a power of two) teams labeled 1..n, build the full tournament bracket string by repeatedly pairing outermost teams (1 with n, 2 with…
General practice
Given user-page visit records, produce for each page a ranked list of recommended pages based on co-visitation patterns (pages users who visited A also visited)…
General practice
Given timestamped user page-view logs, compute for each page the top K pages to recommend based on how frequently users navigate from that page to…
General practice
Given an even-length row of n houses and a cost matrix for 3 colors, find the minimum total painting cost such that no two adjacent…
General practice
Count the number of ways to color an m×n grid with 3 colors so that no two adjacent cells (horizontally or vertically) share a color…
General practice
Pick a subset of walls for the paid painter to minimize total cost such that his total working time allows the free painter (who paints…
General practice
Given an array of song durations, count pairs (i < j) whose sum is divisible by 60; this is solved efficiently by grouping durations by…
General practice
Partition the input string s into substrings so that every substring is a palindrome, and return all possible such partitions. This is typically solved by…
Companies: Salesforce
Backtracking · Dynamic Programming · String
Given a string s, compute the minimum number of cuts needed to partition s into palindromic substrings. This requires identifying palindromic substrings (often precomputed) and…
General practice
Given a string s and integer k, compute the minimum number of character changes needed so s can be split into k non-empty palindromic substrings…
General practice
Determine whether the string s can be split at two positions into three non-empty substrings that are all palindromes — equivalently, whether there exist two…
General practice
Given a string, return all distinct palindromic permutations (or an empty list if none exist) by first checking character counts allow at most one odd…
General practice
Given an even-length string s and queries that allow arbitrary rearrangement of one substring in the left half and one in the right half per…
General practice