Code RoomPort assignment verdicts
EasyPrep Room Coding #4758

Port assignment verdicts

CodingNetworking & APIsEntry–Mid~16 min

A deployment tool audits the port assignments in a service config. Every entry is written as a service name, one equals sign, then a value, with no spaces, for example api=8080. Return one verdict per entry in the same order, written as the name, then a colon, then the verdict word. A value that is not a run of digits, or a number above 65535, is not a port at all and its verdict is invalid. Otherwise read the number, where leading zeros are allowed, and give the verdict conflict when an earlier entry already claimed that same port number. Otherwise the verdict names the range the port falls in: well-known for 0 through 1023, registered for 1024 through 49151, ephemeral for 49152 through 65535. Only an entry that holds a real port claims one.

Implement
audit_service_ports(entries: list[str]) → list[str]
Examples
in[["http=80","api=8080","cache=49999"]]out["http:well-known","api:registered","cache:ephemeral"]
in[["debug=eighty","metrics=70000"]]out["debug:invalid","metrics:invalid"]
in[["a=443","b=0443"]]out["a:well-known","b:conflict"]
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.

0:00 of about 16 min
InputExpectedGot
[["http=80","api=8080","cache=49999"]]["http:well-known","api:registered","cache:ephemeral"]not run yetsample
[["debug=eighty","metrics=70000"]]["debug:invalid","metrics:invalid"]not run yetsample
[["a=443","b=0443"]]["a:well-known","b:conflict"]not run yetsample