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,801–4,825
Given purchase records (user_id, purchase_date), identify users who have any two purchases within a 7-day window—i.e., any pair of that user's purchase dates differ by…
General practice
Given a string s and an empty buffer t that acts like a stack (you can push s's first char onto t or pop t's…
Companies: Bloomberg, Expedia, Rippling
Greedy · Hash Table · Stack · String
Given an array of integers (bytes), determine if they form a valid UTF‑8 encoding by scanning bytes, counting the leading 1 bits in each leading…
General practice
Determine whether two strings are anagrams — i.e., contain the same multiset of characters — by comparing their character frequency distributions (or sorted forms). Inputs…
Companies: Amazon, Google, Meta, Microsoft +1
Hash Table · Sorting · String
Given directed pairs [u,v] as edges, order all pairs so each edge's end equals the next edge's start — this is equivalent to finding an…
General practice
Given exactly three points, determine whether they are all distinct and not collinear by checking that the signed area (or cross product / slope comparison)…
General practice
Check whether the array has length at least 3 and there exists a single peak index 0 < i < n-1 such that the values…
General practice
Count the number of permutations of 0..n that satisfy the adjacent inequality pattern given by s (s[i] = 'I' means perm[i] < perm[i+1], 'D' means…
General practice
Print only the lines from a file that are exact phone numbers in either (xxx) xxx-xxxx or xxx-xxx-xxxx format. The task tests constructing a concise…
General practice
Given four unordered 2D points, determine whether they form a valid square (four equal non-zero side lengths and four right angles). A common check is…
Companies: Pure Storage
Geometry · Math
Companies: Microsoft
Array · Enumeration · Hash Table · Prefix Sum
Count the number of triplets (i, j, k) from nums that can form triangle side lengths — i.e., three values a ≤ b ≤ c…
Companies: Bloomberg
Array · Binary Search · Greedy · Sorting
Check whether a string is a "valid word" by verifying it has length ≥ 3, contains only letters and digits (no other symbols), and includes…
General practice
Check whether a list of words forms a valid word square: for every pair of indices i, j ensure word[i][j] == word[j][i], treating any missing/out-of-range…
General practice
Given n nodes and arrays leftChild/rightChild, determine whether they form exactly one valid binary tree — equivalently check there is exactly one root (one node…
General practice
Determine whether a given permutation popped can be the result of push/pop operations on an initially empty stack when elements are pushed in the order…
General practice
Determine whether a cryptarithmetic equation can be satisfied by assigning distinct digits 0–9 to letters (no leading zeros) so that the numeric sum of the…
General practice
Given an array of integers, determine whether it can represent the preorder traversal of a binary search tree by checking that each node respects BST…
General practice