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 3,826–3,850
For each query price q, return the maximum beauty among items whose price is ≤ q (or 0 if none). With up to 1e5 items/queries…
General practice
Given a list of item prices, a set of available discounts/price adjustments, and a budget, determine the most expensive single item that remains unaffordable even…
General practice
Find the even element that occurs most frequently in the array (breaking ties by choosing the smallest value); return -1 if no even element exists.
General practice
Given a sequence of ID updates where each step adds or removes a given number of copies of an ID, maintain the dynamic multiset of…
Companies: Snowflake
Array · Hash Table · Heap (Priority Queue) · Ordered Set
Count how often each number immediately follows occurrences of a given key in the array and return the number with the highest count. The answer…
General practice
Given an m x n digit matrix, form numbers by walking from every cell in any of the 8 straight directions (appending digits along the…
General practice
Companies: NVIDIA
Aggregate total views per creator to find the most popular creators, while for each creator also tracking their single most-viewed video (breaking ties on equal…
General practice
Given jobs with difficulty and profit and workers with abilities (each worker can do at most one job but jobs can be reused), maximize total…
General practice
In a rooted tree where each node has a positive or negative gate amount, Bob moves from a given node toward the root while Alice…
General practice
Given a circular track with sectors 1..n and a sequence of round endpoints, determine which sector(s) are visited most often after traversing each round in…
General practice
Companies: Meta
Given two strings with 'L', 'R', and blanks where L pieces can only slide left and R pieces only right, determine whether you can transform…
General practice
Companies: Meta
Robots move 1 unit/sec left or right and instantly swap directions on collision; compute the sum of pairwise distances after d seconds modulo 1e9+7. Using…
General practice
Given three distinct integer positions on a line where in each move you can relocate an endpoint stone to any unoccupied integer between the endpoints…
General practice
Given integer positions of stones, determine the minimum and maximum number of moves (each move relocates an endpoint stone to a non-endpoint spot) required to…
General practice
Companies: OpenAI
Multiple step coding question, reasonably simple but quite a lot of functionality to implement. Not a complex problem but you have to be able to…
Companies: Anthropic
Given two polynomials (e.g., as coefficient arrays or sparse term lists), compute the coefficients of their product polynomial. The core challenge is performing the convolution…
General practice
Implement a booking system that accepts an interval only if adding it does not create any time point covered by three events, with book(start,end) returning…
General practice
Return the postorder traversal of an n-ary tree (visit all a node’s children left-to-right before the node itself). Recursive is straightforward; the follow-up asks for…
General practice