Pattern
Hash Map
A compact view of archive entries grouped by recurring technique.
65 entries
65 entries tagged as Hash Map.
22.04.2026
medium2452. Words Within Two Edits of Dictionary
Words in dictionary with 2 edits
17.04.2026
medium3761. Minimum Absolute Distance Between Mirror Pairs
Distance to prev mirror number
26.03.2026
hard3548. Equal Sum Grid Partition II
Cut matrix in half sums, can remove one cell
13.02.2026
medium3714. Longest Balanced Substring II
Largest equal frequencies substring of abc-string
15.01.2026
medium2943. Maximize Area of Square Hole in Grid
Max square area after removing bars in a grid
01.01.2026
easy66. Plus One
Increment big number
04.12.2025
medium2211. Count Collisions on a Road
Collisions R vs L
30.11.2025
medium1590. Make Sum Divisible by P
Min removal to make sum%p
16.10.2025
medium2598. Smallest Missing Non-negative Integer After Operations
First positive number can't be build by adding/subtracting value
21.09.2025
medium1912. Design Movie Rental System
Design Movie Rent: rent,drop,search(5 lowest), report(5 lowest rented)
6.07.2025
medium1865. Finding Pairs With a Certain Sum
Design pairs counter; two lists, one changes
12.05.2025
easy2094. Finding 3-Digit Even Numbers
Triple digit even numbers from digits
25.04.2025
medium2845. Count of Interesting Subarrays
Subarrays, count a[i]%m=k is c%m=k map
27.03.2025
medium2780. Minimum Index of a Valid Split
Min split index to have equal majority elements
25.03.2025
medium3394. Check if Grid can be Cut into Sections
non-intersecting ranges on x or y axis sweep
18.03.2025
medium2401. Longest Nice Subarray
Max window of all pairs AND zero pointers manipulation
17.03.2025
easy2206. Divide Array Into Equal Pairs
All numbers in pairs
09.02.2025
medium2364. Count Number of Bad Pairs
Count pairs a[i] - a[j] != j - i
07.02.2025
medium3160. Find the Number of Distinct Colors Among the Balls
Running colors counter
08.01.2025
easy3042. Count Prefix and Suffix Pairs I
Count prefix-suffix matched pairs
29.12.2024
hard1639. Number of Ways to Form a Target String Given a Dictionary
Ways to make target with increasing positions in words programming
26.12.2024
medium494. Target Sum
Count signs permutations to sum equal target programming
11.12.2024
medium2779. Maximum Beauty of an Array After Applying Operation
Max equal nums after adjusting to [-k..+k] search sweep
04.11.2024
medium3163. String Compression III
Compress repeating chars in string pointers
01.11.2024
easy1957. Delete Characters to Make Fancy String
Filter 3+ repeating chars from string
28.10.2024
medium2501. Longest Square Streak in an Array
Longest quadratic subset
09.10.2024
medium921. Minimum Add to Make Parentheses Valid
Minimum inserts to balance brackets
29.09.2024
hard432. All O`one Data Structure
Count usage frequencies in O(1) list
27.09.2024
medium731. My Calendar II
Add intervals intersecting less than two times sweep
25.09.2024
hard2416. Sum of Prefix Scores of Strings
Counts of words with same prefixes
23.09.2024
hard2707. Extra Characters in a String
Min extra chars to form an s from dictionary programming
17.09.2024
easy884. Uncommon Words from Two Sentences
Unique words from two strings
05.08.2024
easy2053. Kth Distinct String in an Array
kth unique
21.07.2024
hard2392. Build a Matrix With Conditions
Build a matrix from a graph conditions
15.07.2024
medium2196. Create Binary Tree From Descriptions
Restore binary tree from [parent, child, isLeft]
09.06.2024
medium974. Subarray Sums Divisible by K
Count subarrays divisible by k
08.06.2024
medium523. Continuous Subarray Sum
Any subarray sum % k = 0
07.06.2024
medium648. Replace Words
Replace words with suffixes from dictionary
30.05.2024
medium1442. Count Triplets That Can Form Two Arrays of Equal XOR
Number (i,j,k) where xor arr[i..j] = xor arr[j..k] manipulation
08.05.2024
easy506. Relative Ranks
Convert results array to ranks array
27.04.2024
hard514. Freedom Trail
Min steps to produce key by rotating ring programming map
07.04.2024
medium678. Valid Parenthesis String
Are parenthesis valid with wildcard?
04.04.2024
easy1614. Maximum Nesting Depth of the Parentheses
Max nested parenthesis
12.03.2024
medium1171. Remove Zero Sum Consecutive Nodes from Linked List
Remove consequent 0-sum items from a LinkedList
26.01.2024
medium576. Out of Boundary Paths
Number of paths from cell in grid to out of boundary.
18.01.2024
easy70. Climbing Stairs
Ways to climb n stairs by 1 or 2 steps.
16.01.2024
medium380. Insert Delete GetRandom O(1)
Implement HashSet
24.12.2023
easy1758. Minimum Changes To Make Alternating Binary String
In a stressfull situation better to just use 4 counters: oddOnes, evenOnes, oddZeros, evenZeros. Then do something with them.
15.11.2023
medium1846. Maximum Element After Decreasing and Rearranging
Max number from converting array to non decreasing
01.11.2023
easy501. Find Mode in Binary Search Tree
Most frequent elements in a Binary Search Tree
10.10.2023
hard2009. Minimum Number of Operations to Make Array Continuous
Min replacements to make array continuous a[i] = a[i - 1] + 1
5.10.2023
medium229. Majority Element II
Elements with frequency > size / 3
4.10.2023
easy706. Design HashMap
Design a HashMap
2.09.2023
medium2707. Extra Characters in a String
Min count of leftovers after string split by the dictionary
14.07.2023
medium1218. Longest Arithmetic Subsequence of Given Difference
Longest arithmetic difference subsequence
17.06.2023
hard1187. Make Array Strictly Increasing
Minimum replacements to make arr1 increasing using any numbers arr2
31.05.2023
medium1396. Design Underground System
Average time from, to when different user IDs do checkIn(from, time1) and checkOut(to, time2)
30.05.2023
easy705. Design HashSet
Write a HashSet.
11.05.2023
medium1035. Uncrossed Lines
use an array for the faster cache instead of HashMap
16.04.2023
hard1639. Number of Ways to Form a Target String Given a Dictionary
precompute the freq array - count of each character at each position
10.04.2023
medium20. Valid Parentheses
use HashMap to check matching bracket.
30.03.2023
hard87. Scramble String
A simple approach is to concatenate strings, but in Kotlin it gives TLE, so we need bottom up approach, or just operate with indices.
04.03.2023
hard2444. Count Subarrays With Fixed Bounds
For the explicit solution, we take each interval, store positions of the min and max in a TreeSet, then we must take poll those mins and maxes and consider each range separately
2.02.2023
easy953. Verifying an Alien Dictionary
Just translate and then sort and compare. (But we can also just scan linearly and compare).
30.11.2022
easy1207. Unique Number of Occurrences
fun uniqueOccurrences(arr: IntArray): Boolean {