Code RoomShared password detection
EasyPrep Room Coding #4786

Shared password detection

CodingSecurityAlgorithms & data structuresEntry–Mid~15 min

A security review receives an export of stored login credentials, one row per line, written account|algorithm|salt|digest. Nothing is recomputed here: the rows are compared exactly as they arrive. Two different accounts share a password when their algorithm and salt match character for character and their digests match ignoring letter case, since the export tools disagree on hex casing. A row that does not hold exactly four fields, or that leaves any field empty, came from a broken export and is skipped. The same account can appear on several rows, and an account never counts as sharing with itself. Return the names of the accounts that share a credential with at least one other account, each name once, sorted in ascending order. Return an empty list when nothing is shared.

Implement
reused_credential_accounts(dump: list[str]) → list[str]
Examples
in[["ann|argon2|s1|AB12","bob|argon2|s1|ab12","cid|argon2|s2|ab12"]]out["ann","bob"]
in[["ann|bcrypt|s1|ff","bob|bcrypt|s1|FF","cid|bcrypt|s1|Ff"]]out["ann","bob","cid"]
in[["ann|bcrypt|s1|ff","ann|bcrypt|s1|ff"]]out[]
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 15 min
InputExpectedGot
[["ann|argon2|s1|AB12","bob|argon2|s1|ab12","cid|argon2|s2|ab12"]]["ann","bob"]not run yetsample
[["ann|bcrypt|s1|ff","bob|bcrypt|s1|FF","cid|bcrypt|s1|Ff"]]["ann","bob","cid"]not run yetsample
[["ann|bcrypt|s1|ff","ann|bcrypt|s1|ff"]][]not run yetsample