Code RoomPassword rule violations
EasyPrep Room Coding #4754

Password rule violations

CodingSecurityAlgorithms & data structuresEntry–Mid~15 min

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.

Implement
password_policy_failures(candidates: list[str], min_length: int) → list[list[str]]
Examples
in[["Sunset42!","sunset42!"],8]out[[],["upper"]]
in[["aaaB1!x"],6]out[["repeat"]]
in[[""],4]out[["length","upper","lower","digit","symbol"]]
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
[["Sunset42!","sunset42!"],8][[],["upper"]]not run yetsample
[["aaaB1!x"],6][["repeat"]]not run yetsample
[[""],4][["length","upper","lower","digit","symbol"]]not run yetsample