Every Anagram Same Bucket
A signup service buckets usernames with this function and stores each bucket as a linked list.
def h(s: str) -> int:
total = 0
for ch in s:
total += ord(ch)
return total % 1024
An attacker wants 5000 distinct usernames that all land in the same bucket, using as little compute as possible. What is the cheapest construction?
Sign in to answer questions and track your progress
Sign In