dsa1 min read
Brick Wall [Medium] — Gap Position Frequency Map
Find the vertical line that crosses the fewest bricks by counting the most frequent gap position using a HashMap.
Read →
1575 articles
Find the vertical line that crosses the fewest bricks by counting the most frequent gap position using a HashMap.
Check if all value frequencies are unique using two hash sets in O(n).
Count substrings with at most one odd-frequency letter using bitmask prefix XOR and a hash map.
Count (row, col) pairs that are equal by hashing each row tuple and each column tuple.
Find if a BST contains two nodes summing to target using a hash set during DFS traversal.