PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/MathWorks

Determine Whether P's Position Is Unique

Last updated: Apr 12, 2026

Quick Overview

This question evaluates constraint-satisfaction and combinatorial search skills, specifically reasoning about spatial relations and whether a target's location is uniquely determined among all valid assignments on a discrete grid.

  • medium
  • MathWorks
  • Coding & Algorithms
  • Software Engineer

Determine Whether P's Position Is Unique

Company: MathWorks

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

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. You are also given a collection of relational clues describing how the entities may be positioned relative to one another. Examples of such clues include constraints like 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 places `P` in a single location. Otherwise, report that no unique solution exists. Assume rows and columns are 1-indexed.

Quick Answer: This question evaluates constraint-satisfaction and combinatorial search skills, specifically reasoning about spatial relations and whether a target's location is uniquely determined among all valid assignments on a discrete grid.

Related Interview Questions

  • Minimize shortest path by adding weight-1 edges - MathWorks (easy)
  • Maximize minimum after K decrements - MathWorks (easy)
  • How to maximize rewards with exactly k tasks - MathWorks (easy)
  • Maximize minimum value after k decrements - MathWorks (medium)
  • Minimize reduction cost and validate equal-sum pairs - MathWorks (medium)
MathWorks logo
MathWorks
Jan 22, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

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.

You are also given a collection of relational clues describing how the entities may be positioned relative to one another. Examples of such clues include constraints like 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 places P in a single location. Otherwise, report that no unique solution exists.

Assume rows and columns are 1-indexed.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More MathWorks•More Software Engineer•MathWorks Software Engineer•MathWorks Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.