Shared password detection
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.
reused_credential_accounts(dump: list[str]) → list[str][["ann|argon2|s1|AB12","bob|argon2|s1|ab12","cid|argon2|s2|ab12"]]out["ann","bob"][["ann|bcrypt|s1|ff","bob|bcrypt|s1|FF","cid|bcrypt|s1|Ff"]]out["ann","bob","cid"][["ann|bcrypt|s1|ff","ann|bcrypt|s1|ff"]]out[]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.
[["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