Determine Whether P's Position Is Unique
Problem Description
You are given an R x C rectangular grid and a set of named entities. Each entity must be placed in exactly one distinct cell within this grid.
A collection of relational clues describes how these entities may be positioned relative to one another. These clues include constraints such as entities being in the same row, same column, left/right of another entity, or above/below another entity.
Implement a function that determines whether the location of a particular target person P is uniquely determined by all valid placements that satisfy every clue.
Return the unique coordinate (row, column) of P if exactly one valid assignment of all entities places P in a single, specific location. Otherwise, report that no unique solution exists for P.
Assume rows and columns are 1-indexed.
AI interview prep
Core dilemma
The central engineering conflict is efficiently exploring an exponentially large search space of entity placements while ensuring all complex relational constraints are satisfied, and then accurately determining if a specific entity's position is uniquely fixed across all valid solutions without necessarily enumerating all of them.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Determine Whether P's Position Is Unique
Problem Description
You are given an R x C rectangular grid and a set of named entities. Each entity must be placed in exactly one distinct cell within this grid.
A collection of relational clues describes how these entities may be positioned relative to one another. These clues include constraints such as entities being in the same row, same column, left/right of another entity, or above/below another entity.
Implement a function that determines whether the location of a particular target person P is uniquely determined by all valid placements that satisfy every clue.
Return the unique coordinate (row, column) of P if exactly one valid assignment of all entities places P in a single, specific location. Otherwise, report that no unique solution exists for P.
Assume rows and columns are 1-indexed.