hashing-techniques
Installation
SKILL.md
Hashing Techniques Skill
Atomic Responsibility: Execute hash-based lookups and data organization.
Frequency Counting Pattern
from typing import List
from collections import Counter
import heapq
def top_k_frequent(nums: List[int], k: int) -> List[int]:
"""
Find k most frequent elements.
Time: O(n log k), Space: O(n)
"""
count = Counter(nums)
return heapq.nlargest(k, count.keys(), key=count.get)