Cave Advanture

Problem Overview

  • Compute the maximum safe chambers traversed from (0,0) to (N-1,M-1); return -1 if unreachable.
  • Input: N×M grid with '!' safe and 'x' blocked; Output: max visited safe cells or -1.
  • Moves: left, right, or down only; no revisits and no leaving the map.
  • Domain: cave exploration path planning.
  • From Meta interviews; a coding interview problem and common 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: