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,326–4,350
Compute the prefix (running) sum array where runningSum[i] = sum(nums[0..i]), i.e., each output element is the cumulative total up to that index. This is a…
General practice
Given an ordered sequence of records with gender and amount, produce for each row the running total of amounts for that row’s gender up to…
General practice
Given pairs (w,h), find the maximum number of envelopes that can be strictly nested (both width and height increasing) without rotation. Key insight: sort by…
General practice
Given a Sales table, write a basic SQL query to summarize transactions by grouping rows (e.g., by date, product, or seller) and computing aggregate metrics…
General practice
Perform SQL-based sales analysis by joining transaction and reference tables, using GROUP BY/HAVING and subqueries to compute aggregated metrics (e.g., total sales per product…
General practice
List products that were sold exclusively in Q1 2019 (between 2019-01-01 and 2019-03-31): each returned product must have at least one sale in that range…
General practice
Aggregate transaction records by mapping each sale date to its weekday and computing per-weekday sales totals (or averages), ensuring all seven weekdays are represented and…
General practice
Determine whether two binary trees are identical by checking that they have the same structure and corresponding node values (i.e., every pair of corresponding nodes…
General practice
Companies: Netflix
Given an m×n binary matrix where you may toggle any row or column, maximize the sum of rows interpreted as binary numbers. The optimal greedy…
General practice
Compute the "score" of a lowercase string s by scanning adjacent character pairs and summing the absolute differences of their ASCII values; return that total…
General practice
Compute the numeric score of a balanced parentheses string under the rules '()' = 1, concatenation adds scores, and enclosing parentheses double the inner score…
General practice
Determine whether s2 can be obtained from s1 by recursively splitting s1 into two non-empty parts and optionally swapping the parts at each split (i.e.…
General practice
Given the root of a binary search tree and a target value, return the subtree rooted at the node whose value equals the target (or…
General practice
Join sales with products, map each sale date to a season, and aggregate total quantity and revenue per category per season; then for each season…
General practice
Given two lists of records for consecutive days, determine whether the second day's list is a valid verification of the first day (e.g., the same…
General practice
Given a directed "follows" graph, find the unique second-degree followers — users who follow one of a user's followers but do not directly follow that…
General practice
Find the second highest distinct salary from the Employee table and return it, or null if fewer than two distinct salary values exist. Essentially, retrieve…
Companies: Adobe
Database
Given an Employee table of salaries, write an SQL query to return the second-highest distinct salary (or NULL if fewer than two distinct salaries), correctly…
General practice
Given a special binary tree where each internal node's value equals the minimum of its two children and every node has either 0 or 2…
Companies: LinkedIn
Binary Tree · Depth-First Search · Tree
Find the second-smallest travel time from node 1 to n in an undirected graph with uniform edge traversal time, where synchronized traffic lights flipping every…
General practice
Choose at most one cell from each row so that all selected cell values are distinct, maximizing the sum of the chosen values. This is…
General practice
Given a Students table, return the name and age columns for the student whose student_id is 101. Output should include only the name and age…
General practice