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 76–91
Determine whether there exists a consistent one-to-one character mapping from s to t that transforms s into t (i.e., each character in s always maps…
Companies: Meta
Hash Table · String
Companies: Amazon, NVIDIA
Floyd's Cycle Finding Algorithm · Hash Table · Linked List · Two Pointers
Companies: Atlassian
Array · Combinatorics · Enumeration · Hash Table
Given an undirected graph and a set of initially infected nodes, choose one initial node to remove so that the eventual malware spread across connected…
Companies: Zomato
Array · Breadth-First Search · Depth-First Search · Graph Theory
Remove elements from either end to make the sum of removed elements equal x; equivalently, find the longest contiguous subarray whose sum equals total(nums) -…
Companies: Bloomberg
Array · Binary Search · Hash Table · Prefix Sum
Partition the string into the fewest contiguous substrings such that each substring is "balanced" (every distinct character in the substring appears the same number of…
Companies: Grammarly
Counting · Dynamic Programming · Hash Table · String
Given a sequence of ID updates where each step adds or removes a given number of copies of an ID, maintain the dynamic multiset of…
Companies: Snowflake
Array · Hash Table · Heap (Priority Queue) · Ordered Set
Given a list of closed time intervals for when each flower is in full bloom and query times for people arriving, return for each person…
Companies: Roblox
Array · Binary Search · Hash Table · Ordered Set
Count the number of non-empty substrings (in a string of letters 'a'–'j') whose character counts have at most one odd frequency. Core idea: track a…
Companies: Uber
Bit Manipulation · Hash Table · Prefix Sum · String
Sort teams by aggregating position-wise vote counts: compare teams by their counts for first place, then second place, and so on, using alphabetical order as…
Companies: Atlassian
Array · Counting · Hash Table · Sorting
Given lists of positive and negative words and one feedback report per student, compute each student's score (+3 per positive word, -1 per negative word)…
Companies: Booking.com
Array · Hash Table · Heap (Priority Queue) · Sorting
Convert a valid Roman numeral string into its integer value by applying the additive and subtractive rules (e.g., IV = 4, IX = 9, CM…
Companies: Google, Microsoft
Hash Table · Math · String
Count the number of contiguous subarrays whose sum is divisible by k; this reduces to counting pairs of prefix sums with the same remainder modulo…
Companies: TikTok
Array · Hash Table · Prefix Sum
Given an n×n zero matrix and queries that set entire rows or columns (overwriting previous values), compute the final matrix sum. Because later updates override…
Companies: Salesforce
Array · Hash Table
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
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