Skip to content
concept

Constraint Tracking

Maintain compact state representing multiple simultaneous rules that candidate values, placements, or paths must satisfy.

Tagged articles

Constraint Tracking articles

8 articles in this tag.

Illustration of a stock market chart with red and green data, showing market trends and analytics.
intermediate
10 min read

Generate Parentheses

Generate only prefixes that can still become valid. The balance state tells you exactly which branches to keep.

View solution
Close-up of interlocking metal gears creating an industrial texture.
advanced
13 min read

N-Queens II

The key change from N-Queens is the output contract: you need one integer, so the search should retain only reversible constraints and count valid leaves.

View solution
3D abstract geometric structure with gold lines and black polygons on a dark background.
advanced
13 min read

N-Queens

The board is only the output surface. The real N-Queens solution is a depth-n search over column assignments, with three constraints checked before each…

View solution
Detailed view of rough and dry brown soil, showcasing its natural texture.
intermediate
11 min read

Permutations

The search tree is easy to recognize and easy to corrupt. Build one position at a time, choose an unused value, recurse, then undo exactly that choice.

View solution
System with various wires managing access to centralized resource of server in data center
expert
14 min read

Sudoku Solver

The phrase “try digits and backtrack” is the easy part. The interview-grade solution keeps four representations synchronized: the board, row constraints,…

View solution
A modern open laptop with a black screen placed on lush green grass, symbolizing technology and nature.
intermediate
8 min read

Valid Sudoku

A Sudoku validator does not solve the puzzle. It tracks whether the digits already placed violate any row, column, or 3×3 box constraint.

View solution
A child actively assembling a robotics project with electronic components, showcasing technology education.
intermediate
14 min read

Word Search

A grid DFS can match the right letters and still be wrong. The missing piece is path-local state: mark a cell when you enter it, explore from that choice,…

View solution