dsa2 min read
Intersection of Two Arrays II — HashMap Frequency Count [Amazon Easy]
Find the intersection of two integer arrays including duplicates. Each element appears as many times as it shows in both arrays.
Read →
webcoderspeed.com
1276 articles
Find the intersection of two integer arrays including duplicates. Each element appears as many times as it shows in both arrays.
Master cheatsheet of all 100 Arrays & Strings problems: patterns, time/space complexity, and MAANG company tags in one place.
Generate numRows rows of Pascal's triangle. Each interior element is the sum of the two elements above it.
Check if two strings are anagrams — same characters with same frequencies. Two O(n) approaches: 26-int array for lowercase, HashMap for Unicode.
Reverse a character array in-place using two pointers. O(n) time, O(1) space. The fundamental two-pointer swap pattern.