Hash Map Pattern

Trade space for speed with key-value lookups and frequency counting.

#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
325Maximum Size Subarray Sum Equals k
336Palindrome Pairs
340Longest Substring with At Most K Distinct Characters
387First Unique Character in a String
398Random Pick Index
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
734Sentence Similarity
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
1612Check If Two Expression Trees are Equivalent
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
1865Finding Pairs With a Certain Sum
1915Number of Wonderful Substrings
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
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
2152Minimum Number of Lines to Cover Points
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
2248Intersection of Multiple Arrays
2249Count Lattice Points Inside a Circle
2260Minimum Consecutive Cards to Pick Up
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
2357Make Array Zero by Subtracting Equal Amounts
2359Find Closest Node to Given Two Nodes
2360Longest Cycle in a Graph
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
2405Optimal Partition of String
2408Design SQL
2411Smallest Subarrays With Maximum Bitwise OR
2423Remove Letter To Equalize Frequency
2424Longest Uploaded Prefix
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
2465Number of Distinct Averages
2491Divide Players Into Teams of Equal Skill
2501Longest Square Streak in an Array
2506Count Pairs Of Similar Strings
2524Maximum Frequency Score of a Subarray
2531Make Number of Distinct Characters Equal
2564Substring XOR Queries
2568Minimum Impossible OR
2588Count the Number of Beautiful Subarrays
2593Find Score of an Array After Marking All Elements
2596Check Knight Tour Configuration
2598Smallest Missing Non-negative Integer After Operations
2605Form Smallest Number From Two Digit Arrays
2622Cache With Time Limit
2623Memoize
2657Find the Prefix Common Array of Two Arrays
2661First Completely Painted Row or Column
2670Find the Distinct Difference Array
2682Find the Losers of the Circular Game
2716Minimize String Length
2718Sum of Matrix After Queries
2744Find Maximum Number of String Pairs
2748Number of Beautiful Pairs
2763Sum of Imbalance Numbers of All Subarrays
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
2857Count Pairs of Points With Distance k
2869Minimum Operations to Collect Elements
2875Minimum Size Subarray in Infinite Array
2876Count Visited Nodes in a Directed Graph
2913Subarrays Distinct Element Sum of Squares I
2924Find Champion II
2943Maximize Area of Square Hole in Grid
2956Find Common Elements Between Two Arrays
2963Count the Number of Good Partitions
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
2996Smallest Missing Integer Greater Than Sequential Prefix Sum
3002Maximum Size of a Set After Removals
3005Count Elements With Maximum Frequency
3032Count Numbers With Unique Digits II
3039Apply Operations to Make String Empty
3043Find the Length of the Longest Common Prefix
3044Most Frequent Prime
3046Split the Array
3078Match Alphanumerical Pattern in Matrix I
3080Mark Elements on Array by Performing Queries
3083Existence of a Substring in a String and Its Reverse
3104Find Longest Self-Contained Substring
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
3170Lexicographically Minimum String After Removing Stars
3184Count Pairs That Form a Complete Day I
3185Count Pairs That Form a Complete Day II
3217Delete Nodes From Linked List Present in Array
3223Minimum Length of String After Operations
3237Alt and Tab Simulation
3238Find the Number of Winning Players
3242Design Neighbor Sum Service
3261Count Substrings That Satisfy K-Constraint II
3291Minimum Number of Valid Strings to Form Target I
3292Minimum Number of Valid Strings to Form Target II
3295Report Spam Message
3302Find the Lexicographically Smallest Valid Sequence
3331Find Subtree Sizes After Changes
3365Rearrange K Substrings to Form Target String
3371Identify the Largest Outlier in an Array
3375Minimum Operations to Make Array Values Equal to K
3380Maximum Area Rectangle With Point Constraints I
3382Maximum Area Rectangle With Point Constraints II
3396Minimum Number of Operations to Make Elements in Array Distinct
3404Count Special Subsequences
3411Maximum Subarray With Equal Products
3412Find Mirror Score of a String
3438Find Valid Pair of Adjacent Digits in String
3442Maximum Difference Between Even and Odd Frequency I
3447Assign Elements to Groups with Constraints
3450Maximum Students on a Single Bench
3458Select K Disjoint Special Substrings
3471Find the Largest Almost Missing Integer
3484Design Spreadsheet
3487Maximum Unique Subarray Sum After Deletion
3488Closest Equal Element Queries
3514Number of Unique XOR Triplets II
3527Find the Most Common Response
3541Find Most Frequent Vowel and Consonant
3548Equal Sum Grid Partition II
3557Find Maximum Number of Non Intersecting Substrings
3572Maximize Y‑Sum by Picking a Triplet of Distinct X‑Values
3581Count Odd Letters from Number
3588Find Maximum Area of a Triangle
3591Check if Any Element Has Prime Frequency
3606Coupon Code Validator
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
3731Find Missing Elements
3740Minimum Distance Between Three Equal Elements I
3741Minimum Distance Between Three Equal Elements II
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
3799Word Squares II
3803Count Residue Prefixes
3804Number of Centered Subarrays
3805Count Caesar Cipher Pairs
3810Minimum Operations to Reach Target Array
3814Maximum Capacity Within Budget
3815Design Auction System
3822Design Order Management System
3837Delayed Count of Equal Elements
3839Number of Prefix Connected Groups
3843First Element with Unique Frequency
3845Maximum Subarray XOR with Bounded Range
3846Total Distance to Type a String Using One Finger
3848Check Digitorial Permutation
3851Maximum Requests Without Violating the Limit
3852Smallest Pair With Different Frequencies
3860Unique Email Groups
3866First Unique Even Element
3885Design Event Manager
3889Mirror Frequency Distance
3900Longest Balanced Substring After One Swap
3901Good Subsequence Queries
3917Count Indices With Opposite Parity
3921Score Validator
3926Count Valid Word Occurrences
3941Password Strength
3945Digit Frequency Score
3948Lexicographically Maximum MEX Array