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–25
Evaluate a valid arithmetic expression string containing non-negative integers and the operators +, -, *, / (with spaces allowed), where division truncates toward zero. The…
Companies: Anduril, Flex, Meta, Snap +1
Math · Stack · String
Last reported Oct 2026
Design a data structure supporting insert(val), remove(val), and getRandom() — which returns a uniformly random existing element — with each operation in average O(1) time…
Companies: Amazon, Apple, Bloomberg, Citadel +7
Array · Design · Hash Table · Math
Last reported Sep 2026
Design a data structure for a multiset that supports insert(val) (adding even duplicate occurrences), remove(val) (removing a single occurrence), and getRandom() (returning an…
Companies: CrowdStrike, LinkedIn, Okta
Array · Design · Hash Table · Math
Last reported Sep 2026
Convert a fraction to its decimal string form, enclosing any repeating fractional cycle in parentheses. The core challenge is simulating long division while handling sign…
Companies: Goldman Sachs, Meta
Hash Table · Math · String
Last reported Sep 2026
Given N points on the plane and an integer k, return the k points with the smallest Euclidean distance to the origin (order doesn't matter)…
Companies: Airbnb, Amazon, Asana, Meta
Array · Divide and Conquer · Geometry · Heap (Priority Queue)
Last reported Aug 2026
Choose an integer x in [0, 2^n) to maximize (a XOR x) * (b XOR x) (answer mod 1e9+7); the core challenge is picking x’s…
Companies: Atlassian, Cisco, Zomato
Bit Manipulation · Greedy · Math
Last reported Jul 2026
Given an integer array, return the maximum product obtainable by multiplying any three numbers. Consider both the three largest values and the combination of the…
Companies: Salesforce
Array · Math · Sorting
Last reported Jun 2026
Given an array of positive weights, implement pickIndex() to return index i with probability w[i]/sum(w); the typical approach preprocessing prefix sums and using a random…
Companies: Amazon, Apple, Goldman Sachs, Meta +4
Array · Binary Search · Math · Prefix Sum
Last reported Jun 2026
Rotate an integer array to the right by k steps (k may exceed the array length), effectively moving each element to index (i+k) mod n…
Companies: Apple, Microsoft, Nutanix, TikTok
Array · Math · Two Pointers
Last reported Jun 2026
Reverse the digits of a signed 32-bit integer, preserving the sign, and return the reversed number or 0 if reversing would overflow the 32-bit signed…
Companies: Bloomberg, eBay, Google, Meta +2
Math
Last reported May 2026
Determine whether iterating n -> sum of the squares of its digits eventually reaches 1 or falls into a repeating cycle; the core task is…
Companies: Snowflake
Floyd's Cycle Finding Algorithm · Hash Table · Math · Two Pointers
Last reported May 2026
Evaluate a string arithmetic expression containing integers, +, -, *, /, parentheses and unary signs, respecting operator precedence and parentheses. The challenge is to parse…
Companies: Google, Intuit, Meta
Math · Recursion · Stack · String
Last reported May 2026
Convert a non-negative integer to its English words representation. The core challenge is chunking the number into three-digit groups (ones, thousands, millions, billions)…
Companies: Amazon, Microsoft
Math · Recursion · String
Last reported Mar 2026
Design a class that stores an integer array and supports reset (returning the original configuration) and shuffle (returning a uniformly random permutation so that all…
Companies: Microsoft, Uber
Array · Design · Math · Randomized
Last reported Feb 2026
Given a numeric string n (up to 18 digits), find the closest integer palindrome different from n (ties broken by smaller value). The typical approach…
Companies: Meta, Uber
Math · String
Last reported Jan 2026
Given a digit string and a target value, insert the binary operators +, -, and * between digits (without creating operands with leading zeros) to…
Companies: LinkedIn, Meta, Pinterest
Backtracking · Math · String
Last reported Jan 2026
Companies: Amazon, Bloomberg, Google, Meta +2
Linked List · Math · Recursion
Last reported Oct 2025
Count how many ways a given n (1 ≤ n ≤ 10^9) can be written as a sum of consecutive positive integers. The core challenge…
Companies: Meta, Microsoft
Enumeration · Math
Last reported Oct 2025
Compute the positions of the clock's hour and minute hands (noting the hour hand moves continuously with minutes) and return the smaller angular difference between…
Companies: Microsoft, Salesforce, Zoho
Math
Last reported Sep 2025
Multiply two non-negative integer strings without converting them to numeric types or using BigInteger: compute the product by simulating grade-school digit-by-digit…
Companies: Meta, Microsoft, Pinterest
Math · Simulation · String
Last reported Sep 2025
Determine whether an integer's digit sequence reads the same forwards and backwards (return false for negative numbers); the follow-up asks to do this without converting…
Companies: Amazon, Bloomberg, Google, Meta +1
Math
Last reported May 2025
Companies: Meta, Pinterest
Linked List · Math · Stack
Last reported May 2025
Given an n×n matrix, rotate it 90° clockwise in-place (no extra matrix allowed), i.e., rearrange the elements so each row becomes the corresponding column after…
Companies: Bloomberg, ByteDance, Meta, NVIDIA
Array · Math · Matrix
Last reported Feb 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
Evaluate the integer value of an expression given in Reverse Polish Notation, where tokens are integers or the operators +, -, *, / and all…
Companies: Citadel, Google
Array · Math · Stack
Last reported Nov 2024