Hash Table Interview Questions

O(1) lookups, frequency maps, and set-based reasoning.

260 problems

#Title
1Two Sum
3Longest Substring Without Repeating Characters
30Substring with Concatenation of All Words
36Valid Sudoku
49Group Anagrams
76Minimum Window Substring
149Max Points on a Line
159Longest Substring with At Most Two Distinct Characters
170Two Sum III - Data structure design
187Repeated DNA Sequences
202Happy Number
204Count Primes
205Isomorphic Strings
217Contains Duplicate
219Contains Duplicate II
244Shortest Word Distance II
246Strobogrammatic Number
249Group Shifted Strings
266Palindrome Permutation
288Unique Word Abbreviation
290Word Pattern
299Bulls and Cows
305Number of Islands II
314Binary Tree Vertical Order Traversal
323Number of Connected Components in an Undirected Graph
325Maximum Size Subarray Sum Equals k
336Palindrome Pairs
340Longest Substring with At Most K Distinct Characters
356Line Reflection
387First Unique Character in a String
388Longest Absolute File Path
409Longest Palindrome
438Find All Anagrams in a String
447Number of Boomerangs
4544Sum II
473Matchsticks to Square
523Continuous Subarray Sum
525Contiguous Array
532K-diff Pairs in an Array
554Brick Wall
560Subarray Sum Equals K
561Array Partition I
575Distribute Candies
594Longest Harmonious Subsequence
599Minimum Index Sum of Two Lists
609Find Duplicate File in System
721Accounts Merge
734Sentence Similarity
737Sentence Similarity II
748Shortest Completing Word
760Find Anagram Mappings
771Jewels and Stones
811Subdomain Visit Count
822Card Flipping Game
825Friends Of Appropriate Ages
869Reordered Power of 2
873Length of Longest Fibonacci Subsequence
957Prison Cells After N Days
966Vowel Spellchecker
974Subarray Sums Divisible by K
982Triples with Bitwise AND Equal To Zero
1001Grid Illumination
1124Longest Well-Performing Interval
1133Largest Unique Number
1152Analyze User Website Visit Pattern
1153String Transforms Into Another String
1160Find Words That Can Be Formed by Characters
1165Single-Row Keyboard
1198Find Smallest Common Element in All Rows
1207Unique Number of Occurrences
1224Maximum Equal Frequency
1418Display Table of Food Orders in a Restaurant
1452People Whose List of Favorite Companies Is Not a Subset of Another List
1487Making File Names Unique
1577Number of Ways Where Square of Number Is Equal to Product of Two Numbers
1590Make Sum Divisible by P
1640Check Array Formation Through Concatenation
1657Determine if Two Strings Are Close
1679Max Number of K-Sum Pairs
1711Count Good Meals
1748Sum of Unique Elements
1781Sum of Beauty of All Substrings
1807Evaluate the Bracket Pairs of a String
1814Count Nice Pairs in an Array
1817Finding the Users Active Minutes
1915Number of Wonderful Substrings
1923Longest Common Subpath
1925Count Square Sum Triples
1930Unique Length-3 Palindromic Subsequences
1941Check if All Characters Have Equal Number of Occurrences
1995Count Special Quadruplets
2006Count Number of Pairs With Absolute Difference K
2023Number of Pairs of Strings With Concatenation Equal to Target
2025Maximum Number of Ways to Partition an Array
2032Two Out of Three
2053Kth Distinct String in an Array
2068Check Whether Two Strings are Almost Equivalent
2085Count Common Words With One Occurrence
2120Execution of All Suffix Instructions Staying in a Grid
2150Find All Lonely Numbers in the Array
2154Keep Multiplying Found Values by Two
2170Minimum Operations to Make the Array Alternating
2190Most Frequent Number Following Key In an Array
2201Count Artifacts That Can Be Extracted
2206Divide Array Into Equal Pairs
2215Find the Difference of Two Arrays
2225Find Players With Zero or One Losses
2229Check if an Array Is Consecutive
2260Minimum Consecutive Cards to Pick Up
2261K Divisible Elements Subarrays
2283Check if Number Has Equal Digit Count and Digit Value
2284Sender With Largest Word Count
2287Rearrange Characters to Make Target String
2295Replace Elements in an Array
2306Naming a Company
2309Greatest English Letter in Upper and Lower Case
2325Decode the Message
2341Maximum Number of Pairs in Array
2342Max Sum of a Pair With Equal Sum of Digits
2347Best Poker Hand
2351First Letter to Appear Twice
2352Equal Row and Column Pairs
2354Number of Excellent Pairs
2357Make Array Zero by Subtracting Equal Amounts
2363Merge Similar Items
2364Count Number of Bad Pairs
2365Task Scheduler II
2367Number of Arithmetic Triplets
2374Node With Highest Edge Score
2395Find Subarrays With Equal Sum
2399Check Distances Between Same Letters
2404Most Frequent Even Element
2423Remove Letter To Equalize Frequency
2441Largest Positive Integer That Exists With Its Negative
2442Count Number of Distinct Integers After Reverse Operations
2451Odd String Difference
2452Words Within Two Edits of Dictionary
2453Destroy Sequential Targets
2456Most Popular Video Creator
2484Count Palindromic Subsequences
2488Count Subarrays With Median K
2489Number of Substrings With Fixed Ratio
2491Divide Players Into Teams of Equal Skill
2501Longest Square Streak in an Array
2506Count Pairs Of Similar Strings
2531Make Number of Distinct Characters Equal
2564Substring XOR Queries
2588Count the Number of Beautiful Subarrays
2592Maximize Greatness of an Array
2598Smallest Missing Non-negative Integer After Operations
2605Form Smallest Number From Two Digit Arrays
2615Sum of Distances
2657Find the Prefix Common Array of Two Arrays
2661First Completely Painted Row or Column
2670Find the Distinct Difference Array
2716Minimize String Length
2718Sum of Matrix After Queries
2744Find Maximum Number of String Pairs
2748Number of Beautiful Pairs
2766Relocate Marbles
2768Number of Black Blocks
2784Check if Array is Good
2808Minimum Seconds to Equalize a Circular Array
2815Max Pair Sum in an Array
2839Check if Strings Can be Made Equal With Operations I
2840Check if Strings Can be Made Equal With Operations II
2845Count of Interesting Subarrays
2857Count Pairs of Points With Distance k
2869Minimum Operations to Collect Elements
2943Maximize Area of Square Hole in Grid
2947Count Beautiful Substrings I
2949Count Beautiful Substrings II
2950Number of Divisible Substrings
2955Number of Same-End Substrings
2956Find Common Elements Between Two Arrays
2964Number of Divisible Triplet Sums
2975Maximum Square Area by Removing Fences From a Field
2981Find Longest Special Substring That Occurs Thrice I
2982Find Longest Special Substring That Occurs Thrice II
2983Palindrome Rearrangement Queries
2996Smallest Missing Integer Greater Than Sequential Prefix Sum
3005Count Elements With Maximum Frequency
3039Apply Operations to Make String Empty
3044Most Frequent Prime
3046Split the Array
3078Match Alphanumerical Pattern in Matrix I
3083Existence of a Substring in a String and Its Reverse
3120Count the Number of Special Characters I
3121Count the Number of Special Characters II
3137Minimum Number of Operations to Make Word K-Periodic
3138Minimum Length of Anagram Concatenation
3143Maximum Points Inside the Square
3146Permutation Difference between Two Strings
3158Find the XOR of Numbers Which Appear Twice
3160Find the Number of Distinct Colors Among the Balls
3167Better Compression of String
3184Count Pairs That Form a Complete Day I
3185Count Pairs That Form a Complete Day II
3223Minimum Length of String After Operations
3237Alt and Tab Simulation
3238Find the Number of Winning Players
3245Alternating Groups III
3295Report Spam Message
3365Rearrange K Substrings to Form Target String
3371Identify the Largest Outlier in an Array
3396Minimum Number of Operations to Make Elements in Array Distinct
3404Count Special Subsequences
3438Find Valid Pair of Adjacent Digits in String
3442Maximum Difference Between Even and Odd Frequency I
3450Maximum Students on a Single Bench
3471Find the Largest Almost Missing Integer
3487Maximum Unique Subarray Sum After Deletion
3488Closest Equal Element Queries
3527Find the Most Common Response
3541Find Most Frequent Vowel and Consonant
3572Maximize Y‑Sum by Picking a Triplet of Distinct X‑Values
3581Count Odd Letters from Number
3591Check if Any Element Has Prime Frequency
3636Threshold Majority Queries
3662Filter Characters by Frequency
3663Find The Least Frequent Digit
3668Restore Finishing Order
3678Smallest Absent Positive Greater Than Average
3682Minimum Index Sum of Common Elements
3692Majority Frequency Characters
3694Distinct Points Reachable After Substring Removal
3712Sum of Elements With Frequency Divisible by K
3713Longest Balanced Substring I
3714Longest Balanced Substring II
3718Smallest Missing Multiple of K
3728Stable Subarrays With Equal Boundary and Interior Sum
3729Count Distinct Subarrays Divisible by K in Sorted Array
3755Find Maximum Balanced XOR Subarray Length
3760Maximum Substrings With Distinct Start
3761Minimum Absolute Distance Between Mirror Pairs
3773Maximum Number of Equal Length Runs
3779Minimum Number of Operations to Have Distinct Elements
3784Minimum Deletion Cost to Make All Characters Equal
3803Count Residue Prefixes
3804Number of Centered Subarrays
3805Count Caesar Cipher Pairs
3810Minimum Operations to Reach Target Array
3837Delayed Count of Equal Elements
3839Number of Prefix Connected Groups
3842Toggle Light Bulbs
3843First Element with Unique Frequency
3846Total Distance to Type a String Using One Finger
3848Check Digitorial Permutation
3852Smallest Pair With Different Frequencies
3866First Unique Even Element
3889Mirror Frequency Distance
3890Integers With Multiple Sum of Two Cubes
3900Longest Balanced Substring After One Swap
3901Good Subsequence Queries
3913Sort Vowels by Frequency
3917Count Indices With Opposite Parity
3921Score Validator
3926Count Valid Word Occurrences
3945Digit Frequency Score
3960Frequency Balance Subarray