Trains the technique from
LeetCode 36Valid SudokuThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A depot keeps crates on a storage rack shaped as a 9 x 9 grid of slots, handed to you as rack. Every slot holds either one crate, written as a single character from '1' to '9' naming its hazard class, or nothing at all, written as '.'.
Safety policy forbids two crates of the same hazard class from sharing:
Only slots that currently hold a crate are subject to the policy; empty slots never conflict with anything. You are auditing the layout as it stands and not planning the rest of the load, so a layout passes the audit even when there is no legal way to fill the remaining empty slots.
Return true when the current layout breaks none of the three rules, and false otherwise.
Example 1
Four crates sit on the rack and no two of them share a row, a column or a bay, so the audit passes.
Example 2
The two class 6 crates sit in different rows and different columns, but both land in the top-left bay, which the policy forbids.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def audit_rack(rack: list[list[str]]) -> bool:public boolean auditRack(char[][] rack)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.