NumPy allowed · plain Python earns 10 bonus points
Implement consistent hash ring lookup, the core operation behind distributed caching and load balancing.
Hash key using hash(key) % 360 and find the first node at or after that position in the sorted ring list. Wrap around if needed. Raise ValueError if empty.
consistent_hash_lookup(key: str, ring: list[tuple[int, str]]) -> str