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,126–1,150
Given a map of rooms/levels that alter your health (positive or negative), compute the minimum initial health required to reach the goal without your health…
Companies: Amazon
Last reported Jan 2025
This problem involves assigning interns to flats using a greedy algorithm. The goal is to optimize the allocation based on certain criteria, such as minimizing…
Companies: Google
Last reported Jan 2025
Sort an integer array in ascending order without using built-in sort routines, achieving O(n log n) time and minimal extra space; input size is up…
Companies: Amazon, Microsoft
Last reported Jan 2025
Given a Binary Search Tree (BST), find if there exists a triplet of nodes such that their values sum up to zero. Return true if…
Companies: Amazon
Last reported Jan 2025
Recreate a given UI live using HTML and CSS
Companies: Amazon
Last reported Jan 2025
Implement the flatmap function, which is a common operation in functional programming. Discuss its use cases, how it differs from map and flatten, and provide…
Companies: Airbnb
Last reported Jan 2025
Find the lexicographically smallest permutation that maximizes information gain for a given array. Information gain is calculated as the sum of i * data[p[i]] for…
Companies: Amazon
Last reported Jan 2025
Given an array of numbers, return the number of monotonic stacks, both increasing and decreasing.
Companies: Meta
Last reported Jan 2025
Find the longest substring such that every character in that substring has all of its occurrences contained within it (i.e., no character from the substring…
Companies: Amazon
Last reported Jan 2025
Find three non-overlapping subarrays of length k whose total sum is maximized and return their starting indices (choose the lexicographically smallest tuple on ties). This…
Companies: Meta
Last reported Jan 2025
Count the number of non-empty submatrices in a 2D integer matrix whose elements sum to a given target. The common approach reduces the 2D problem…
Companies: Meta
Last reported Jan 2025
Simulate days on an m×n grid where infected cells spread 4-directionally: each day identify all connected infected regions, compute for each the set of uninfected…
Companies: Flipkart, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Jan 2025
Given a weighted graph where some edges are designated as highways, find the maximum-cost trip between two nodes while using at most K highways (or…
Companies: Meta
Last reported Jan 2025
Generate all possible orderings of a list of distinct integers — i.e., return every permutation of the array. The challenge is to enumerate all n!…
Companies: Meta
Last reported Jan 2025
Given a tree (or graph) whose nodes are labeled 0 or 1 and a set of rules/operations that change node values based on ancestors or…
Companies: Google
Last reported Jan 2025
Partition the array so that all even numbers appear before all odd numbers, returning any arrangement that satisfies this; order within the even/odd groups doesn't…
Companies: Meta, Zoho
Array · Sorting · Two Pointers
Last reported Jan 2025
Count the number of index triplets (i<j<k) in an array whose three values are pairwise distinct. With n ≤ 100 this reduces to combinatorially counting…
Companies: Google
Last reported Jan 2025
Remove bad pairs from a string. A bad pair is defined as adjacent characters that are the same letter in different cases (e.g., 'xX'). Implement…
Companies: Google
Last reported Jan 2025
Given an array of vulnerabilities for n servers, calculate the sum of system vulnerabilities for all subsegments. System vulnerability is defined as the product of…
Companies: Amazon
Last reported Jan 2025
Rearrange the characters of a string so that no two adjacent characters are the same, returning any valid permutation or "" if none exists. Key…
Companies: Amazon, D. E. Shaw, Tesla
Counting · Greedy · Hash Table · Heap (Priority Queue)
Last reported Jan 2025
Given a binary tree, return the 'zigzag side view': one node value per level, alternating between the leftmost node on even levels and the rightmost…
Companies: Meta
Last reported Jan 2025
Companies: OpenAI
Bit Manipulation · Data Structure Design
Last reported Jan 2025
Given up to 300 unique 2D points, return the maximum number that lie on the same straight line. The core challenge is grouping points by…
Companies: Google, LinkedIn
Array · Euclidean Algorithm · Geometry · Greatest Common Divisor
Last reported Jan 2025
Given a string representing a sequence of bottles ('a' for aluminum, 'b' for glass, 'c' for plastic) on a conveyor belt and an integer k…
Companies: Amazon
Last reported Jan 2025
Given a permutation of lowercase letters defining an alien alphabet, verify the words are lexicographically sorted by mapping each character to its rank and comparing…
Companies: Meta
Last reported Jan 2025