← All problemsSign in

2258. Escape the Spreading Fire

LeetCodeArrayBinary SearchBreadth-First SearchMatrixOpen on judge ↗

You are given a 0-indexed 2D integer array grid of size m x n which represents a field. Each cell has one of three values: - 0 represents grass, - 1 represents fire, - 2 represents a wall that you and fire cannot pass through. You are situated in the top-left cell, (0, 0), and you want to travel to the safehouse at the bottom-right cell, (m - 1, n - 1). Every minute, you may move to an adjacen

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start