Password rule violations
A password reset service checks each proposal against six house rules before it will store one. In order, the rules are: length, broken when the proposal holds fewer than min_length characters; upper, broken when no character falls in A to Z; lower, broken when none falls in a to z; digit, broken when none falls in 0 to 9; symbol, broken when every character is a letter or a digit, so nothing else appears; and repeat, broken when some character occurs three or more times in a row. Proposals are printable ASCII, and a space counts as a symbol. Return one list per proposal, keeping the proposals in the order they were submitted, holding the codes of the rules that proposal breaks, spelled exactly as above and kept in the order listed. A proposal that breaks nothing gives an empty list.
password_policy_failures(candidates: list[str], min_length: int) → list[list[str]][["Sunset42!","sunset42!"],8]out[[],["upper"]][["aaaB1!x"],6]out[["repeat"]][[""],4]out[["length","upper","lower","digit","symbol"]]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.
[["Sunset42!","sunset42!"],8][[],["upper"]]not run yetsample[["aaaB1!x"],6][["repeat"]]not run yetsample[[""],4][["length","upper","lower","digit","symbol"]]not run yetsample