Amazon Hash Table Questions

424 hash table problems asked at Amazon interviews

Easy (101)Medium (257)Hard (66)

Questions

TitleDifficulty
Two SumEasy
LRU CacheMedium
Longest Substring Without Repeating CharactersMedium
Group AnagramsMedium
Reorganize StringMedium
Subarray Sum Equals KMedium
Top K Frequent ElementsMedium
Longest Consecutive SequenceMedium
Copy List with Random PointerMedium
Word LadderHard
Majority ElementEasy
Letter Combinations of a Phone NumberMedium
Valid AnagramEasy
Analyze User Website Visit PatternMedium
Task SchedulerMedium
Roman to IntegerEasy
Insert Delete GetRandom O(1)Medium
Word BreakMedium
First Missing PositiveHard
Longest Repeating Character ReplacementMedium
Fruit Into BasketsMedium
Minimum Window SubstringHard
Valid SudokuMedium
Identify the Largest Outlier in an ArrayMedium
LFU CacheHard
All Nodes Distance K in Binary TreeMedium
Set Matrix ZeroesMedium
Contains DuplicateEasy
First Unique Character in a StringEasy
Missing NumberEasy
Integer to RomanMedium
Next Greater Element IEasy
Linked List CycleEasy
Word Break IIHard
Intersection of Two ArraysEasy
Happy NumberEasy
Contains Duplicate IIEasy
Sudoku SolverHard
Maximum Frequency After Subarray OperationMedium
Time Based Key-Value StoreMedium
Isomorphic StringsEasy
Make Array Zero by Subtracting Equal AmountsEasy
Intersection of Two Linked ListsEasy
Subarrays with K Different IntegersHard
Construct Binary Tree from Preorder and Inorder TraversalMedium
Find All Anagrams in a StringMedium
Vertical Order Traversal of a Binary TreeHard
Word Ladder IIHard
Permutation in StringMedium
Lowest Common Ancestor of a Binary Tree IIIMedium
Linked List Cycle IIMedium
Top K Frequent WordsMedium
Partition LabelsMedium
Sort Characters By FrequencyMedium
Majority Element IIMedium
Set MismatchEasy
Contiguous ArrayMedium
Open the LockMedium
Smallest Range Covering Elements from K ListsHard
Design HashMapEasy
Accounts MergeMedium
Design TwitterMedium
Implement Trie (Prefix Tree)Medium
Maximum Sum of Distinct Subarrays With Length KMedium
Design Tic-Tac-ToeMedium
Find Missing and Repeated ValuesEasy
Ransom NoteEasy
Clone GraphMedium
Unique Number of OccurrencesEasy
Design In-Memory File SystemHard
Number of Distinct IslandsMedium
Amount of Time for Binary Tree to Be InfectedMedium
First Unique NumberMedium
Bus RoutesHard
Jewels and StonesEasy
Find Longest Self-Contained SubstringHard
Substring with Concatenation of All WordsHard
Find All Numbers Disappeared in an ArrayEasy
Binary Subarrays With SumMedium
Make Sum Divisible by PMedium
Minimum Number of Pushes to Type Word IIMedium
Substring With Largest VarianceHard
Longest Substring with At Least K Repeating CharactersMedium
Two Sum IV - Input is a BSTEasy
Using a Robot to Print the Lexicographically Smallest StringMedium
Sum of Beauty of All SubstringsMedium
Custom Sort StringMedium
Path CrossingEasy
Count Number of Rectangles Containing Each PointMedium
Best Poker HandEasy
Number of Equivalent Domino PairsEasy
Max Sum of a Pair With Equal Sum of DigitsMedium
Find All Duplicates in an ArrayMedium
The Number of the Smallest Unoccupied ChairMedium
Cousins in Binary Tree IIMedium
Count the Number of Special Characters IEasy
Total Appeal of A StringHard
Count Subarrays With Median KHard
Find the DifferenceEasy
Meeting Rooms IIIHard
Minimum Swaps to Avoid Forbidden ValuesHard
Design Memory AllocatorMedium
All O`one Data StructureHard
Count Number of Pairs With Absolute Difference KEasy
Minimum Operations to Make the Array AlternatingMedium
Lowest Common Ancestor of a Binary Tree IVMedium
Smallest Number in Infinite SetMedium
Minimum Rounds to Complete All TasksMedium
Clone Binary Tree With Random PointerMedium
Most Frequent Subtree SumMedium
Optimal Partition of StringMedium
Most Stones Removed with Same Row or ColumnMedium
Repeated DNA SequencesMedium
Continuous Subarray SumMedium
Find All Possible Recipes from Given SuppliesMedium
Maximum Erasure ValueMedium
Unique Length-3 Palindromic SubsequencesMedium
K-diff Pairs in an ArrayMedium
Most Common WordEasy
Count Beautiful Substrings IMedium
Number of Distinct Islands IIHard
Encode and Decode TinyURLMedium
Maximum Score Words Formed by LettersHard
Logger Rate LimiterEasy
Minimum Genetic MutationMedium
Max Number of K-Sum PairsMedium
Max Points on a LineHard
Design File SystemMedium
Binary Tree Vertical Order TraversalMedium
Check If Array Pairs Are Divisible by kMedium
Count Zero Request ServersMedium
Minimum Number of Operations to Make Elements in Array DistinctEasy
Count Covered BuildingsMedium
Longest PalindromeEasy
Subarray Sums Divisible by KMedium
How Many Numbers Are Smaller Than the Current NumberEasy
Design a Food Rating SystemMedium
Minimum Number of Operations to Make Array EmptyMedium
K Divisible Elements SubarraysMedium
High FiveEasy
Distant BarcodesMedium
Find and Replace PatternMedium
Maximize the Profit as the SalesmanMedium
Most Frequent IDsMedium
Count Number of TextsMedium
Get Watched Videos by Your FriendsMedium
Minimum Operations to Reduce X to ZeroMedium
Maximum Frequency StackHard
Delete and EarnMedium
Design an Array Statistics TrackerHard
Insert Delete GetRandom O(1) - Duplicates allowedHard
Maximize Y‑Sum by Picking a Triplet of Distinct X‑ValuesMedium
Prison Cells After N DaysMedium
Maximum Number of Non-Overlapping SubstringsHard
Minimum Number of KeypressesMedium
Length of the Longest Valid SubstringHard
Kth Distinct String in an ArrayEasy
Find Distance in a Binary TreeMedium
Replace Question Marks in String to Minimize Its ValueMedium
Design SQLMedium
Find Words That Can Be Formed by CharactersEasy
Replace Elements in an ArrayMedium
Find the Length of the Longest Common PrefixMedium
Bulls and CowsMedium
Word PatternEasy
Magic Squares In GridMedium
Construct Binary Tree from Inorder and Postorder TraversalMedium
Snapshot ArrayMedium
Lexicographically Maximum MEX ArrayHard
Number of Substrings Containing All Three CharactersMedium
Number of Submatrices That Sum to TargetHard
Longest Square Streak in an ArrayMedium
Find the Substring With Maximum CostMedium
Relocate MarblesMedium
Number of Distinct AveragesEasy
Find K-Length Substrings With No Repeated CharactersMedium
Subarrays Distinct Element Sum of Squares IIHard
Largest Unique NumberEasy
Clone N-ary TreeMedium
Maximum Linear Stock ScoreMedium
Count Beautiful Substrings IIHard
Find the Maximum Number of Elements in SubsetMedium
Count Numbers With Unique Digits IIEasy
Rearrange Characters to Make Target StringEasy
Count the Number of Special Characters IIMedium
Count Pairs Of NodesHard
Sort Features by PopularityMedium
Maximum Sum of Almost Unique SubarrayMedium
Maximize the Beauty of the GardenHard
Distinct Numbers in Each SubarrayMedium
Find the Prefix Common Array of Two ArraysMedium
Minimum Number of Groups to Create a Valid AssignmentMedium
Count Elements With Maximum FrequencyEasy
Pairs of Songs With Total Durations Divisible by 60Medium
Find the Town JudgeEasy
Find the Difference of Two ArraysEasy
Find the Median of the Uniqueness ArrayHard
Delete Nodes From Linked List Present in ArrayMedium
Avoid Flood in The CityMedium
Longest Harmonious SubsequenceEasy
Find Winner on a Tic Tac Toe GameEasy
Minimize Array Sum Using Divisible ReplacementsMedium
Create Binary Tree From DescriptionsMedium
Find Common CharactersEasy
Intersection of Two Arrays IIEasy
Number of Good PairsEasy
Sort Array by Increasing FrequencyEasy
Ugly Number IIMedium
Count Number of Bad PairsMedium
Lexicographically Minimum String After Removing StarsMedium
Find Duplicate SubtreesMedium
Threshold Majority QueriesHard
Walking Robot SimulationMedium
Longest Balanced Substring IMedium
Number of AtomsHard
Count Number of Nice SubarraysMedium
Longest Substring with At Most K Distinct CharactersMedium
Reordered Power of 2Medium
Word SubsetsMedium
Finding 3-Digit Even NumbersEasy
Total Characters in String After Transformations IMedium
Vowel SpellcheckerMedium
Sliding Window MedianHard
Check If N and Its Double ExistEasy
Unique 3-Digit Even NumbersEasy
Lexicographically Smallest Permutation Greater Than TargetMedium
Minimum Moves to Make Array ComplementaryMedium
Jump Game IVHard
Minimum Pair Removal to Sort Array IIHard
Find Resultant Array After Removing AnagramsEasy
Design Task ManagerMedium
Rabbits in ForestMedium
Regions Cut By SlashesMedium
Invalid TransactionsMedium
Maximum Difference Between Even and Odd Frequency IEasy
Length of Longest Fibonacci SubsequenceMedium
Maximum Subarray Sum With Length Divisible by KMedium
Hand of StraightsMedium
Sum of Unique ElementsEasy
Design Snake GameMedium
Maximum Total Damage With Spell CastingMedium
Maximum Good Subarray SumMedium
Buddy StringsEasy
N-Repeated Element in Size 2N ArrayEasy
Minimum Index Sum of Two ListsEasy
Check If a String Contains All Binary Codes of Size KMedium
Longest Balanced Subarray IMedium
Longest Balanced Substring IIMedium
Find Score of an Array After Marking All ElementsMedium
Check if the Sentence Is PangramEasy
Fraction to Recurring DecimalMedium
Number of Matching SubsequencesMedium
Relative Sort ArrayEasy
Extra Characters in a StringMedium
Count Complete Subarrays in an ArrayMedium
Divide Players Into Teams of Equal SkillMedium
Find the Longest Substring Containing Vowels in Even CountsMedium
Rank Transform of an ArrayEasy
Task Scheduler IIMedium
Rearrange String k Distance ApartHard
Find Duplicate File in SystemMedium
Kill ProcessMedium
Fair Candy SwapEasy
Verifying an Alien DictionaryEasy
Find Subsequence of Length K With the Largest SumEasy
Take K of Each Character From Left and RightMedium
Count Vowel Substrings of a StringEasy
Minimum Pair Removal to Sort Array IEasy
Smallest Missing Non-negative Integer After OperationsMedium
Pyramid Transition MatrixMedium
Maximum Number of BalloonsEasy
Largest Palindromic NumberMedium
First Completely Painted Row or ColumnMedium
Minimum Absolute Distance Between Mirror PairsMedium
Brick WallMedium
Sort the PeopleEasy
Number of Islands IIHard
Find Unique Binary StringMedium
Sum of DistancesMedium
Longest Arithmetic SubsequenceMedium
Rearranging FruitsHard
Linked List ComponentsMedium
Sliding Subarray BeautyMedium
Delete Nodes And Return ForestMedium
Palindrome PairsHard
Design A LeaderboardMedium
Group the People Given the Group Size They Belong ToMedium
Design Underground SystemMedium
Least Number of Unique Integers after K RemovalsMedium
Dot Product of Two Sparse VectorsMedium
Check if One String Swap Can Make Strings EqualEasy
Decode the MessageEasy
4Sum IIMedium
Largest Combination With Bitwise AND Greater Than ZeroMedium
Design Log Storage SystemMedium
Design Excel Sum FormulaHard
Minimum Deletions to Make Character Frequencies UniqueMedium
Minimum Operations to Convert All Elements to ZeroMedium
Maximum Unique Subarray Sum After DeletionEasy
Find X-Sum of All K-Long Subarrays IEasy
Largest Positive Integer That Exists With Its NegativeEasy
Substrings of Size Three with Distinct CharactersEasy
Stock Price FluctuationMedium
Number of Good Ways to Split a StringMedium
Finding the Users Active MinutesMedium
Minimum Number of People to TeachMedium
Detect SquaresMedium
Closest Equal Element QueriesMedium
Minimum Jumps to Reach End via Prime TeleportationMedium
Divide an Array Into Subarrays With Minimum Cost IIHard
Longest Balanced Subarray IIHard
Perfect RectangleHard
Merge BSTs to Create Single BSTHard
Maximum Size Subarray Sum Equals kMedium
Random Pick IndexMedium
Keyboard RowEasy
Design HashSetEasy
Remove Zero Sum Consecutive Nodes from Linked ListMedium
Minimum Number of Steps to Make Two Strings AnagramMedium
Destination CityEasy
Determine if Two Strings Are CloseMedium
Count the Number of Good SubarraysMedium
Degree of an ArrayEasy
Find Occurrences of an Element in an ArrayMedium
HTML Entity ParserMedium
Dinner Plate StacksHard
Uncommon Words from Two SentencesEasy
Split a String Into the Max Number of Unique SubstringsMedium
Construct K Palindrome StringsMedium
Flip Columns For Maximum Number of Equal RowsMedium
Minimum Operations to Make a SubsequenceHard
Circular Array LoopMedium
Tuple with Same ProductMedium
Employee ImportanceMedium
Data Stream as Disjoint IntervalsHard
Number of Pairs of Interchangeable RectanglesMedium
Count of Substrings Containing Every Vowel and K Consonants IIMedium
Find the Number of Distinct Colors Among the BallsMedium
Sentence Similarity IIMedium
Count Unique Characters of All Substrings of a Given StringHard
Divide Array Into Equal PairsEasy
Finding Pairs With a Certain SumMedium
Maximum Number of Words You Can TypeEasy
Max Pair Sum in an ArrayEasy
The Two Sneaky Numbers of DigitvilleEasy
Check if All the Integers in a Range Are CoveredEasy
Check if All Characters Have Equal Number of OccurrencesEasy
Maximum XOR of Two Numbers in an ArrayMedium
Find Most Frequent Vowel and ConsonantEasy
Longest String ChainMedium
Count Largest GroupEasy
Power Grid MaintenanceMedium
Minimum Time to Collect All Apples in a TreeMedium
Longest Nice SubstringEasy
Escape a Large MazeHard
Smallest Integer Divisible by KMedium
Minimize Malware SpreadHard
Split Array With Same AverageHard
Rank Teams by VotesMedium
Maximum Number of Occurrences of a SubstringMedium
Unique Email AddressesEasy
Number of Good PathsHard
Minimum Subarray Length With Distinct Sum At Least KMedium
Check if Strings Can be Made Equal With Operations IIMedium
Minimum Distance Between Three Equal Elements IEasy
K-Similar StringsHard
Construct Binary Tree from Preorder and Postorder TraversalMedium
Equal Row and Column PairsMedium
Length of Longest Subarray With at Most K FrequencyMedium
The Number of Beautiful SubsetsMedium
Find Elements in a Contaminated Binary TreeMedium
Find the Number of Good Pairs IIMedium
Find Longest Special Substring That Occurs Thrice IMedium
Make Two Arrays Equal by Reversing SubarraysEasy
Two Sum III - Data structure designEasy
Word Pattern IIMedium
Random Pick with BlacklistHard
Simple Bank SystemMedium
Minimum Length of String After OperationsMedium
Describe the PaintingMedium
Select K Disjoint Special SubstringsMedium
Increasing Decreasing StringEasy
Merge Two 2D Arrays by Summing ValuesEasy
Find Common Elements Between Two ArraysEasy
Minimum Index of a Valid SplitMedium
Two-Letter Card GameMedium
Longest Substring with At Most Two Distinct CharactersMedium
Find Smallest Common Element in All RowsMedium
Longest Subsequence Repeated k TimesHard
Find Lucky Integer in an ArrayEasy
Delete Duplicate Folders in SystemHard
Stable Subarrays With Equal Boundary and Interior SumMedium
Lowest Common Ancestor of Deepest LeavesMedium
Find Valid Pair of Adjacent Digits in StringEasy
Remove Duplicates From an Unsorted Linked ListMedium
Count Substrings That Can Be Rearranged to Contain a String IMedium
Maximum Size of a Set After RemovalsMedium
Minimum Operations to Write the Letter Y on a GridMedium
Sum of Perfect Square AncestorsHard
Non-decreasing SubsequencesMedium
Encrypt and Decrypt StringsHard
Longest Word in DictionaryMedium
Minimum Seconds to Equalize a Circular ArrayMedium
Smallest Subtree with all the Deepest NodesMedium
Operations on TreeMedium
Implement RouterMedium
Count Good MealsMedium
Design Movie Rental SystemHard
Similar String GroupsHard
Sparse Matrix MultiplicationMedium
Restore the Array From Adjacent PairsMedium
Find Original Array From Doubled ArrayMedium
Implement Trie II (Prefix Tree)Medium
Design SpreadsheetMedium
3Sum With MultiplicityMedium
Unique Morse Code WordsEasy
Longest Palindrome by Concatenating Two Letter WordsMedium
Grid Teleportation TraversalMedium
Minimum Distance Between Three Equal Elements IIMedium
Properties GraphMedium
Largest Color Value in a Directed GraphHard
Find the Distinct Difference ArrayEasy
Binary Trees With FactorsMedium
Find Mirror Score of a StringMedium

Showing 424 questions