Google Hash Table Questions

500 hash table problems asked at Google interviews

Easy (122)Medium (292)Hard (86)

Questions

TitleDifficulty
Two SumEasy
Longest Substring Without Repeating CharactersMedium
Longest Consecutive SequenceMedium
Majority ElementEasy
Roman to IntegerEasy
Subarray Sum Equals KMedium
LRU CacheMedium
Letter Combinations of a Phone NumberMedium
Top K Frequent ElementsMedium
Valid AnagramEasy
Group AnagramsMedium
Logger Rate LimiterEasy
Happy NumberEasy
Longest Repeating Character ReplacementMedium
Set Matrix ZeroesMedium
Contains DuplicateEasy
Intersection of Two ArraysEasy
Count Number of Trapezoids IIHard
First Missing PositiveHard
Fruit Into BasketsMedium
Insert Delete GetRandom O(1)Medium
Sudoku SolverHard
Find All Numbers Disappeared in an ArrayEasy
Valid SudokuMedium
Linked List CycleEasy
Contains Duplicate IIEasy
Isomorphic StringsEasy
Word BreakMedium
Missing NumberEasy
Minimum Area RectangleMedium
Count Number of Trapezoids IMedium
Unique Number of OccurrencesEasy
Minimum Window SubstringHard
Permutation in StringMedium
Integer to RomanMedium
Apply SubstitutionsMedium
First Unique Character in a StringEasy
Meeting Rooms IIIHard
Find the DifferenceEasy
Word LadderHard
Majority Element IIMedium
Next Greater Element IEasy
Delete Nodes And Return ForestMedium
Intersection of Two Linked ListsEasy
Task SchedulerMedium
Clone GraphMedium
Ransom NoteEasy
Copy List with Random PointerMedium
Reorganize StringMedium
Group Shifted StringsMedium
Minimum Area Rectangle IIMedium
Find Missing and Repeated ValuesEasy
LFU CacheHard
Implement Trie (Prefix Tree)Medium
Find All Duplicates in an ArrayMedium
Find All Possible Recipes from Given SuppliesMedium
Number of Islands IIHard
Binary Subarrays With SumMedium
Contiguous ArrayMedium
Number of Matching SubsequencesMedium
Linked List Cycle IIMedium
Find And Replace in StringMedium
Construct Binary Tree from Preorder and Inorder TraversalMedium
Accounts MergeMedium
Substring with Concatenation of All WordsHard
Snapshot ArrayMedium
Vertical Order Traversal of a Binary TreeHard
Set MismatchEasy
Detect SquaresMedium
Find Longest Special Substring That Occurs Thrice IMedium
Bus RoutesHard
Subarrays with K Different IntegersHard
Sort Characters By FrequencyMedium
Rank Transform of an ArrayEasy
Maximum XOR of Two Numbers in an ArrayMedium
Fraction to Recurring DecimalMedium
Find X-Sum of All K-Long Subarrays IEasy
Find All Anagrams in a StringMedium
Unique Length-3 Palindromic SubsequencesMedium
Design a Number Container SystemMedium
Longest PalindromeEasy
Top K Frequent WordsMedium
Find Duplicate SubtreesMedium
Word Break IIHard
Delete Nodes From Linked List Present in ArrayMedium
Divide Array in Sets of K Consecutive NumbersMedium
Maximum Good Subarray SumMedium
Jewels and StonesEasy
Regions Cut By SlashesMedium
Binary Tree Vertical Order TraversalMedium
Longest Arithmetic Subsequence of Given DifferenceMedium
Tuple with Same ProductMedium
Sliding Window MedianHard
Sender With Largest Word CountMedium
Subarray Sums Divisible by KMedium
Sum of Beauty of All SubstringsMedium
Smallest Integer Divisible by KMedium
Check If N and Its Double ExistEasy
Find Original Array From Doubled ArrayMedium
Find the Difference of Two ArraysEasy
How Many Numbers Are Smaller Than the Current NumberEasy
Word Ladder IIHard
Number of Good PairsEasy
Intersection of Two Arrays IIEasy
Minimum Operations to Reduce X to ZeroMedium
All Nodes Distance K in Binary TreeMedium
Maximum Number of Ways to Partition an ArrayHard
Time Based Key-Value StoreMedium
Two Sum IV - Input is a BSTEasy
Max Points on a LineHard
Longest Arithmetic SubsequenceMedium
First Letter to Appear TwiceEasy
Palindrome PairsHard
Count Special SubsequencesMedium
Count Number of Bad PairsMedium
Sum of Good SubsequencesHard
Path Existence Queries in a Graph IMedium
Word SubsetsMedium
Rank Teams by VotesMedium
Magic Squares In GridMedium
X of a Kind in a Deck of CardsEasy
Stock Price FluctuationMedium
Find the Length of the Longest Common PrefixMedium
Find the Prefix Common Array of Two ArraysMedium
Number of Substrings Containing All Three CharactersMedium
Pyramid Transition MatrixMedium
Buddy StringsEasy
Unique Email AddressesEasy
Describe the PaintingMedium
Merge Two 2D Arrays by Summing ValuesEasy
Construct Binary Tree from Preorder and Postorder TraversalMedium
Evaluate the Bracket Pairs of a StringMedium
Check If a String Contains All Binary Codes of Size KMedium
Longest Harmonious SubsequenceEasy
All O`one Data StructureHard
Arithmetic SubarraysMedium
Number of Flowers in Full BloomHard
Bulls and CowsMedium
Jump Game IVHard
Longest String ChainMedium
Minimum Pair Removal to Sort Array IEasy
Continuous Subarray SumMedium
Count Number of Nice SubarraysMedium
Next Closest TimeMedium
Number of Good Ways to Split a StringMedium
Split a String Into the Max Number of Unique SubstringsMedium
Largest Component Size by Common FactorHard
Similar String GroupsHard
Number of Good PathsHard
Number of AtomsHard
Implement Magic DictionaryMedium
Online ElectionMedium
Most Stones Removed with Same Row or ColumnMedium
Maximum Sum of Distinct Subarrays With Length KMedium
Word PatternEasy
Number of Same-End SubstringsMedium
Smallest Range Covering Elements from K ListsHard
Avoid Flood in The CityMedium
Perfect RectangleHard
Count Number of Distinct Integers After Reverse OperationsMedium
Encode and Decode TinyURLMedium
Sentence Similarity IIMedium
Letter Tile PossibilitiesMedium
Check if DFS Strings Are PalindromesHard
Rearrange String k Distance ApartHard
Create Binary Tree From DescriptionsMedium
Design TwitterMedium
Longest Balanced Subarray IIHard
Number of Wonderful SubstringsMedium
Repeated DNA SequencesMedium
Maximum Erasure ValueMedium
Construct Binary Tree from Inorder and Postorder TraversalMedium
Design Task ManagerMedium
Design Snake GameMedium
Largest Color Value in a Directed GraphHard
Minimum Consecutive Cards to Pick UpMedium
Longest Uncommon Subsequence IIMedium
Longest Substring with At Most Two Distinct CharactersMedium
Most Frequent Number Following Key In an ArrayEasy
Check if Number Has Equal Digit Count and Digit ValueEasy
Line ReflectionMedium
Number of BoomerangsMedium
Sentence SimilarityEasy
Linked List ComponentsMedium
K-Similar StringsHard
Single-Row KeyboardEasy
Alphabet Board PathMedium
Split Array into Consecutive SubsequencesMedium
Binary String With Substrings Representing 1 To NMedium
Finding 3-Digit Even NumbersEasy
Longest Substring with At Least K Repeating CharactersMedium
Max Number of K-Sum PairsMedium
Find the Maximum Number of Elements in SubsetMedium
Reordered Power of 2Medium
Partition StringMedium
Hand of StraightsMedium
Number of Equivalent Domino PairsEasy
Longest Substring with At Most K Distinct CharactersMedium
Count K-Subsequences of a String With Maximum BeautyHard
Find Longest Special Substring That Occurs Thrice IIMedium
Design Phone DirectoryMedium
Operations on TreeMedium
Find All Lonely Numbers in the ArrayMedium
Strobogrammatic NumberEasy
Design Tic-Tac-ToeMedium
Merge Similar ItemsEasy
Longest Uploaded PrefixMedium
Make Number of Distinct Characters EqualMedium
Add Bold Tag in StringMedium
Shortest Completing WordEasy
Sum of Imbalance Numbers of All SubarraysHard
Brace Expansion IIHard
Minimum Number of Operations to Make Word K-PeriodicMedium
Sum of Digit Differences of All PairsMedium
Find Two Non-overlapping Sub-arrays Each With Target SumMedium
Find Root of N-Ary TreeMedium
Throne InheritanceMedium
Distribute Repeating IntegersHard
Minimum Operations to Make a SubsequenceHard
Find Anagram MappingsEasy
K-diff Pairs in an ArrayMedium
Find the Town JudgeEasy
Rabbits in ForestMedium
Fair Candy SwapEasy
Most Frequent PrimeMedium
Count the Number of Good PartitionsHard
Count Subarrays With Median KHard
Rings and RodsEasy
Longest Common Subsequence Between Sorted ArraysMedium
Recover the Original ArrayHard
Count Words Obtained After Adding a LetterMedium
Palindrome PermutationEasy
Unique Word AbbreviationMedium
Design Video Sharing PlatformHard
Shortest Impossible Sequence of RollsHard
Sort Array by Moving Items to Empty SpaceHard
Count Subarrays With More Ones Than ZerosMedium
Lonely Pixel IMedium
Lonely Pixel IIMedium
Bold Words in StringMedium
Random Pick with BlacklistHard
Count Pairs of Points With Distance kMedium
Random Flip MatrixMedium
Array of Doubled PairsMedium
String Transforms Into Another StringHard
Largest Values From LabelsMedium
Compare Strings by Frequency of the Smallest CharacterMedium
Find Elements in a Contaminated Binary TreeMedium
People Whose List of Favorite Companies Is Not a Subset of Another ListMedium
Maximum Number of Non-Overlapping Subarrays With Sum Equals TargetMedium
Find Latest Group of Size MMedium
Check If Two Expression Trees are EquivalentMedium
Correct a Binary TreeMedium
Change Minimum Characters to Satisfy One of Three ConditionsMedium
Count Pairs of Equal Substrings With Minimum DifferenceMedium
Count Caesar Cipher PairsMedium
Minimum Genetic MutationMedium
Subdomain Visit CountMedium
N-Repeated Element in Size 2N ArrayEasy
Check if the Sentence Is PangramEasy
Determine if Two Strings Are CloseMedium
Find Common CharactersEasy
Check If Array Pairs Are Divisible by kMedium
Delete and EarnMedium
Find Unique Binary StringMedium
Keyboard RowEasy
Employee ImportanceMedium
Design HashMapEasy
Sort Array by Increasing FrequencyEasy
Make Sum Divisible by PMedium
Design HashSetEasy
Lowest Common Ancestor of a Binary Tree IIIMedium
Rearranging FruitsHard
Next Greater Numerically Balanced NumberMedium
Ugly Number IIMedium
Number of Submatrices That Sum to TargetHard
Relative Sort ArrayEasy
Partition LabelsMedium
Count the Number of Good SubarraysMedium
Insert Delete GetRandom O(1) - Duplicates allowedHard
Threshold Majority QueriesHard
Power Update After K-th Largest Insertion IMedium
Extra Characters in a StringMedium
The Number of the Smallest Unoccupied ChairMedium
First Completely Painted Row or ColumnMedium
Smallest String With SwapsMedium
Lowest Common Ancestor of Deepest LeavesMedium
Count Largest GroupEasy
Maximum Subarray Sum With Length Divisible by KMedium
Minimum Common ValueEasy
Count Vowel Substrings of a StringEasy
Longest Palindrome by Concatenating Two Letter WordsMedium
Open the LockMedium
Construct K Palindrome StringsMedium
Equal Row and Column PairsMedium
Cousins in Binary Tree IIMedium
Find the Count of Good IntegersHard
Take K of Each Character From Left and RightMedium
Max Sum of a Pair With Equal Sum of DigitsMedium
Identify the Largest Outlier in an ArrayMedium
Construct String With Repeat LimitMedium
Find the Number of Distinct Colors Among the BallsMedium
Design Excel Sum FormulaHard
Simple Bank SystemMedium
The Two Sneaky Numbers of DigitvilleEasy
Longest Subsequence Repeated k TimesHard
Count Covered BuildingsMedium
Find Subsequence of Length K With the Largest SumEasy
Find Lucky Integer in an ArrayEasy
4Sum IIMedium
Minimum Number of Steps to Make Two Strings AnagramMedium
Smallest Number in Infinite SetMedium
Count Complete Subarrays in an ArrayMedium
Degree of an ArrayEasy
Find Resultant Array After Removing AnagramsEasy
Keep Multiplying Found Values by TwoEasy
Count the Number of Special Characters IIMedium
Minimum Jumps to Reach End via Prime TeleportationMedium
Check if Array is GoodEasy
Minimum Moves to Make Array ComplementaryMedium
Sum of DistancesMedium
Maximum Square Area by Removing Fences From a FieldMedium
Find Missing ElementsEasy
Longest Balanced Substring IIMedium
Invalid TransactionsMedium
Count Special TripletsMedium
Remove Letter To Equalize FrequencyEasy
Find Most Frequent Vowel and ConsonantEasy
Brick WallMedium
Most Common WordEasy
Count the Number of Consistent StringsEasy
Find the Longest Substring Containing Vowels in Even CountsMedium
Count of Interesting SubarraysMedium
Total Characters in String After Transformations IIHard
Sort the PeopleEasy
Flip Columns For Maximum Number of Equal RowsMedium
Reconstruct Original Digits from EnglishMedium
Length of Longest Fibonacci SubsequenceMedium
Lexicographically Minimum String After Removing StarsMedium
Maximize Subarray Sum After Removing All Occurrences of One ElementHard
Finding Pairs With a Certain SumMedium
Maximum Unique Subarray Sum After DeletionEasy
Maximum Frequency After Subarray OperationMedium
Minimum Operations to Make Array Values Equal to KEasy
Power Grid MaintenanceMedium
Maximum Number of Words You Can TypeEasy
Minimum Operations to Convert All Elements to ZeroMedium
Minimum Number of Operations to Make Array ContinuousHard
Design In-Memory File SystemHard
Design File SystemMedium
Count Elements With Maximum FrequencyEasy
Uncommon Words from Two SentencesEasy
Number of Distinct IslandsMedium
Custom Sort StringMedium
Minimum Number of People to TeachMedium
Maximum Total Damage With Spell CastingMedium
Find Words That Can Be Formed by CharactersEasy
Equal Sum Grid Partition IIHard
Smallest Subtree with all the Deepest NodesMedium
Verifying an Alien DictionaryEasy
Max Pair Sum in an ArrayEasy
Find Common Elements Between Two ArraysEasy
Find and Replace PatternMedium
Find Players With Zero or One LossesMedium
Path CrossingEasy
Count Number of Pairs With Absolute Difference KEasy
Design a Food Rating SystemMedium
Basic Calculator IVHard
Tweet Counts Per FrequencyMedium
Find Winner on a Tic Tac Toe GameEasy
Largest Combination With Bitwise AND Greater Than ZeroMedium
Delete Duplicate Folders in SystemHard
Find Score of an Array After Marking All ElementsMedium
Analyze User Website Visit PatternMedium
Check if One String Swap Can Make Strings EqualEasy
Minimum Index of a Valid SplitMedium
Minimum Swaps to Sort by Digit SumMedium
Number of Squareful ArraysHard
Vowel SpellcheckerMedium
Find X-Sum of All K-Long Subarrays IIHard
Most Frequent Even ElementEasy
Amount of Time for Binary Tree to Be InfectedMedium
Longest Nice SubstringEasy
Count the Number of Special Characters IEasy
Pairs of Songs With Total Durations Divisible by 60Medium
Divide Array Into Equal PairsEasy
Sum of Unique ElementsEasy
Parse Lisp ExpressionHard
Decode the MessageEasy
Design SpreadsheetMedium
Check if Strings Can be Made Equal With Operations IIMedium
Closest Equal Element QueriesMedium
Minimum Absolute Distance Between Mirror PairsMedium
Design Auction SystemMedium
Walking Robot SimulationMedium
Maximum Score Words Formed by LettersHard
Dot Product of Two Sparse VectorsMedium
Restore the Array From Adjacent PairsMedium
Swap For Longest Repeated Character SubstringMedium
Number of Distinct Islands IIHard
Total Appeal of A StringHard
Minimum Number of Operations to Make Elements in Array DistinctEasy
Longest Special Path IIHard
Total Characters in String After Transformations IMedium
Design Underground SystemMedium
Count Special QuadrupletsEasy
Maximum Difference Between Even and Odd Frequency IEasy
Unique 3-Digit Even NumbersEasy
Shortest Word Distance IIMedium
Coupon Code ValidatorEasy
Task Scheduler IIMedium
Divide an Array Into Subarrays With Minimum Cost IIHard
HTML Entity ParserMedium
3Sum With MultiplicityMedium
Card Flipping GameMedium
Make the XOR of All Segments Equal to ZeroHard
Data Stream as Disjoint IntervalsHard
Split the ArrayEasy
Maximum Frequency StackHard
Find the Number of Winning PlayersEasy
Implement RouterMedium
Smallest Missing Integer Greater Than Sequential Prefix SumEasy
Design A LeaderboardMedium
Two-Letter Card GameMedium
Subarrays Distinct Element Sum of Squares IEasy
Maximum Number of BalloonsEasy
Minimum Distance Between Three Equal Elements IIMedium
Count Subarrays With Majority Element IMedium
Count Residue PrefixesEasy
Longest Balanced Subarray IMedium
Longest Balanced Substring IMedium
Number of Pairs of Interchangeable RectanglesMedium
Stickers to Spell WordHard
Optimal Partition of StringMedium
Remove Zero Sum Consecutive Nodes from Linked ListMedium
Count Triplets That Can Form Two Arrays of Equal XORMedium
Least Number of Unique Integers after K RemovalsMedium
Prefix and Suffix SearchHard
Replace WordsMedium
Largest Positive Integer That Exists With Its NegativeEasy
Minimum Array Changes to Make Differences EqualMedium
Kth Distinct String in an ArrayEasy
Check if All Characters Have Equal Number of OccurrencesEasy
Sorted GCD Pair QueriesHard
Count Substrings With K-Frequency Characters IMedium
Longest Square Streak in an ArrayMedium
Maximum Size Subarray Sum Equals kMedium
Sparse Matrix MultiplicationMedium
Find Maximum Removals From Source StringMedium
Minimum Operations to Make Character Frequencies EqualHard
Map Sum PairsMedium
Minimum Index Sum of Two ListsEasy
Find the XOR of Numbers Which Appear TwiceEasy
Encrypt and Decrypt StringsHard
Count Pairs That Form a Complete Day IIMedium
Group the People Given the Group Size They Belong ToMedium
Minimize Malware SpreadHard
Length of the Longest Valid SubstringHard
Minimum Deletions to Make String K-SpecialMedium
Longest Word in DictionaryMedium
Find Maximum Area of a TriangleMedium
Non-decreasing SubsequencesMedium
Distribute CandiesEasy
Increasing Decreasing StringEasy
Convert an Array Into a 2D Array With ConditionsMedium
Minimum Deletions to Make Character Frequencies UniqueMedium
Partition Array Into K-Distinct GroupsMedium
Find Mirror Score of a StringMedium
Minimize String LengthEasy
Distinct Prime Factors of Product of ArrayMedium
Number of Arithmetic TripletsEasy
Split Array With Same AverageHard
Escape a Large MazeHard
Find the Largest Almost Missing IntegerEasy
Sum of Perfect Square AncestorsHard
Lexicographically Smallest Permutation Greater Than TargetMedium
Second Largest Digit in a StringEasy
Binary Trees With FactorsMedium
Dinner Plate StacksHard
Length of Longest Subarray With at Most K FrequencyMedium
Count Paths That Can Form a Palindrome in a TreeHard
Find Duplicate File in SystemMedium
Count Nice Pairs in an ArrayMedium
The Number of Beautiful SubsetsMedium
Right TrianglesMedium
Find Valid Pair of Adjacent Digits in StringEasy
Minimum Deletions for At Most K Distinct CharactersEasy
Merge BSTs to Create Single BSTHard
Minimum Pair Removal to Sort Array IIHard
Number of Black BlocksMedium
Reachable Nodes With RestrictionsMedium
Random Pick IndexMedium
Minimum Distance Between Three Equal Elements IEasy
Longest Balanced Substring After One SwapMedium
First Unique NumberMedium
Maximize Count of Distinct Primes After SplitHard
Circular Array LoopMedium
Find Subarrays With Equal SumEasy
Count Good MealsMedium
Maximum Number of Occurrences of a SubstringMedium

Showing 500 questions