Optimal Path in a Grid

Problem Overview

  • Find a path from A[0] to B[N-1] in a 2xN grid (rows A and B), moving only right or down, that minimizes the maximum cell value encountered; return that minimized maximum.
  • Input: two integer arrays A and B of length N; Output: one integer (the path’s maximum value); constraints as stated in the problem.
  • Models path planning with a minimax goal, like minimizing worst-case risk or cost along a corridor.
  • From Microsoft interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: