A rental site gets sign-ups in order; sign-up i is names[i], emails[i], phones[i]. It's accepted only if its email and phone are both unclaimed, and accepting claims both. Rejected sign-ups claim nothing; names don't matter.
Compare normalised values: emails with surrounding whitespace (spaces, tabs) removed and case ignored, phones by their digits only ("+1 (415) 555-0100" equals "14155550100").
Write register(names: list[str], emails: list[str], phones: list[str]) -> list[bool] returning whether each sign-up was accepted.
names = ["kofi", "lena", "kofi", "omar", "pia"]
emails = ["kofi@x.io", "lena@x.io", "KOFI@x.io ", "omar@x.io", "pia@x.io"]
phones = ["555-0101", "555-0102", "555 0199", "(555) 0102", "5550199"]
register(names, emails, phones)
# [True, True, False, False, True]
# 2: email clashes with sign-up 0 (case and spaces don't matter)
# 3: phone clashes with sign-up 1
# 4: phone matches sign-up 2, but sign-up 2 was rejected, so nothing was claimed
Up to 200,000 sign-ups; normalised values are never empty.
⭐ Bonus: checking each sign-up against every earlier one passes; a speed test with 200,000 sign-ups earns a star at O(1) per sign-up.
Show hint
two sets of normalised values, updated only on acceptance.