Validate email format
Implement safe structural email validation for a registration form. Return True only if `email` is a single local part, exactly one '@', and a domain with a dot-separated TLD of at least two letters. Specifically it must match: local part of [A-Za-z0-9._%+-]+, then '@', then a domain of [A-Za-z0-9.-]+, then a literal dot, then a TLD of 2+ letters, anchored to the whole string. Reject anything with zero or multiple '@'. Empty string is invalid.
Implement
is_valid_email(email: str) → boolExamples
in
["alice@example.com"]outtrueWhat a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 12 min
solution.py
InputExpectedGot
["alice@example.com"]truenot run yetsample