Code Room
CodingMediumcod-g1143
Subject Networking protocolsLevel Mid–Senior~22 minCommon in Networking & APIs · Algorithms & data structures interviewsIndustries Software development, IT services

Question

Implement simplified email-address validation. An address is valid iff: it has exactly one '@'; both local and domain parts are non-empty; the local part is at most 64 chars and the whole address at most 254; the local part contains only letters, digits, and the characters .!#$%&'*+/=?^_`{|}~- and does not start/end with a dot or contain '..'; the domain has at least two dot-separated labels, each label is 1-63 chars of letters/digits/hyphen, not starting or ending with a hyphen; and the whole address is ASCII. Return True/False.

Implement
validate_email(addr: str) → bool
Examples
in["user@example.com"]outtrue
What 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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.