dsa1 min read
Find Duplicate File in System [Medium] — Content HashMap
Find all groups of duplicate files by parsing path strings and grouping files by their content using a HashMap.
Read →
1575 articles
Find all groups of duplicate files by parsing path strings and grouping files by their content using a HashMap.
Group strings that are anagrams together by using their sorted form as a HashMap key.
Find the k most frequent elements in O(n) using bucket sort by frequency instead of a heap.
Design a Least Recently Used cache with O(1) get and put operations using a HashMap combined with a doubly linked list.
Count subarrays with sum exactly k using prefix sums stored in a HashMap to find valid starting positions in O(n).