# Algorithmic Problem Domain ## Approach - Model the problem state explicitly (structs/enums), separate from I/O. - Define invariants and validate inputs before solving. - Choose algorithm by constraints: brute force (small), BFS/DFS, IDA*, A*, dynamic programming, greedy, heuristic search. - Provide a reference/naive implementation for correctness checking. - Benchmark with criterion; profile before optimizing. ## Common Patterns - State-space search with visited set and pruning. - Backtracking with constraint propagation. - Memoization / DP tables. - Bitmask representations for small state spaces. - Move generation + undo (for puzzles/games). ## Testing - Unit tests for move/invariant correctness. - Property tests (proptest) for round-trip moves. - Known-answer tests (Kociemba, IDA* expected lengths). - Fuzz input parsing. ## Pitfalls - Off-by-one in move indexing. - Forgetting parity/invariant checks (illegal states "solve"). - Heuristic not admissible → wrong shortest path. - State representation mismatch (cubie vs sticker). - Overflow in depth/counters. - Non-deterministic ordering breaking reproducibility. ## Libraries (Rust) - (none required) pure std; optional: rand (scrambles), criterion (bench), proptest (tests). "