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,976–2,000
Return an array of the number of 1-bits (popcount) for every integer from 0 to n, with the challenge to compute all counts in O(n)…
General practice
Given an integer array, count how many elements x have x+1 also present in the array (count duplicates separately). Use a hash set or frequency…
General practice
Given an array of lowercase strings and a target prefix, return how many strings start with that prefix — a straightforward count of strings whose…
General practice
Given a directed graph of investment edges between countries, identify all countries from which every path eventually terminates and never reaches a cycle (i.e., "safe"…
General practice
Filter the coupons to those with a non-empty code containing only alphanumeric characters or underscores, a businessLine in {"electronics","grocery","pharmacy","restaurant"}…
General practice
Given courses with durations and deadlines, schedule non-overlapping courses starting at day 1 to maximize the number you can finish by their deadlines; the core…
General practice
Given a DAG of course prerequisites, determine for each query whether there is a directed path from course u to course v (i.e., whether u…
General practice
Determine whether two given nodes in a binary tree are cousins — i.e., they have the same depth but different parents — by traversing the…
General practice
Replace each node's value with the sum of all nodes at the same depth that have different parents (its cousins) and return the modified tree…
General practice
Simulate the folder navigation described by the logs and track the current depth (or stack height): "x/" increments depth, "./" is a no-op, "../" decrements…
General practice
Given a 2D list where each row contains a student ID and age, construct a DataFrame with columns "student_id" and "age" preserving the original row…
General practice
Add a new column "bonus" to the employees table/DataFrame whose values are simply twice the salary for each row (i.e., bonus = salary * 2)…
General practice
Given a list of user session records (timestamps and/or durations), aggregate and group those sessions into fixed time buckets to produce counts or summary metrics…
General practice
Given a tree with positive node values, delete edges to split it into connected components so that every component has the same sum, and return…
General practice
Implement createHelloWorld to return a new function that ignores any arguments and always returns the string "Hello World". The returned function should produce "Hello World"…
General practice
Given two digit arrays and an integer k, pick subsequences (preserving relative order) from each array whose total length is k and merge them to…
General practice
Given two arrays — one of keys and one of values — construct an object/dictionary that maps each keys[i] to values[i], paying attention to handling…
General practice
Given an array of instructions, process elements left-to-right inserting each into an array and add cost = min(number of prior elements strictly less than x…
General practice
Given arrays nums and index, construct the target array by iterating i from 0..n-1 and inserting nums[i] at position index[i] (shifting elements to the right…
General practice