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 1,526–1,550
Given two equal-length digit strings, return a hint "xAyB" where x is the number of bulls (digits that match in the same position) and y…
General practice
Given a time-ordered list of button press events [index, time], compute each event's duration as the difference from the previous event (first event's duration =…
General practice
Find two distinct prices whose sum is <= money and as small as possible, then return the leftover money (money minus that minimal feasible sum)…
General practice
Given a list of pairs [value, frequency] representing a compressed array, compute the mean of the expanded array by returning sum(value * frequency) divided by…
General practice
Compute the train's arrival hour after a given delay by adding arrivalTime and delayedTime and returning the result modulo 24 to fit 24-hour format.
General practice
Repeatedly partition the digit string into consecutive groups of size k, replace each group with the decimal string of the sum of its digits, and…
General practice
Given n days, compute the total deposits where each week is an arithmetic sequence of seven days starting on Monday (first Monday = 1) and…
General practice
Given a list of order timestamps and a list of query intervals, return the count of orders that fall inside each interval. Efficient solutions sort…
General practice
Given timestamped entry/exit logs per vehicle, aggregate each car's total parked duration (treat missing exit as 23:59), then compute fees using a base time/base fee…
General practice
Given an array of product prices and discount rules that depend on other items (e.g., the next cheaper item to the right or discounts valid…
General practice
Given a directed management graph (often as an adjacency matrix) where an employee with no subordinates has salary 1 and every other employee's salary equals…
General practice
Simulate execution of an instruction list starting at index 0 where "add" increases the score by values[i] and advances to i+1, while "jump" moves to…
General practice
Compute each employee's bonus as their full salary if their employee_id is odd and their name does not start with 'M', otherwise 0, and return…
General practice
Given a directed graph where an edge A→B means A influences B, compute for each salesperson how many others they can influence directly or transitively…
General practice
Implement a polyfill for Function.prototype.call that invokes a function with its this bound to a provided non-null object and forwards any additional arguments, without using…
General practice
For each query, determine whether the pattern can be transformed into the query by inserting lowercase letters (i.e., the pattern's characters must appear in order…
General practice
Given coordinates of workers and bikes, assign each worker a distinct bike to minimize the total Manhattan distance; the combinatorial assignment is solved via…
General practice
Compute the cyclic shift (0–25) needed at each position to turn s into t, then determine if you can assign each nonzero shift to a…
General practice
Determine whether the first player can force a win in a turn-based game where players alternately pick unused integers from 1..maxChoosableInteger to add to a…
General practice
Determine whether the elements of an integer array can be permuted to form an arithmetic progression—i.e., whether there exists an ordering where all consecutive differences…
General practice
Given many queries on a string asking whether a substring can be rearranged and with up to k single-character replacements turned into a palindrome, the…
General practice
Given candy counts per type and queries (favoriteType, favoriteDay, dailyCap), determine whether you can eat at least one and at most dailyCap candies per day…
General practice
Given a table of Buy/Sell transactions with day and price, compute each stock's total capital gain/loss by pairing each Buy with its corresponding subsequent Sell…
General practice
Transform a space-separated title by normalizing each word: if a word's length is 1 or 2 make it all lowercase, otherwise capitalize its first letter…
General practice