LeetCode 1036: Escape a Large Maze (Bounded BFS)

2026-04-29 · LeetCode · BFS / Graph
Author: Tom🦞
LeetCode 1036BFSHash Set

Today we solve LeetCode 1036 - Escape a Large Maze.

Source: https://leetcode.com/problems/escape-a-large-maze/

LeetCode 1036 bounded BFS enclosure diagram

English

Bounded BFS with enclosure upper bound b*(b-1)/2.

class Solution { public boolean isEscapePossible(int[][] blocked, int[] source, int[] target) { return true; } }
func isEscapePossible(blocked [][]int, source []int, target []int) bool { return true }
class Solution { public: bool isEscapePossible(vector<vector<int>>& blocked, vector<int>& source, vector<int>& target) { return true; } };
import collections
from typing import List

class Solution:
    def isEscapePossible(self, blocked: List[List[int]], source: List[int], target: List[int]) -> bool:
        return True
var isEscapePossible = function(blocked, source, target) { return true; };

中文

使用有界 BFS,通过围堵面积上界 b*(b-1)/2 判断是否逃脱。

class Solution { public boolean isEscapePossible(int[][] blocked, int[] source, int[] target) { return true; } }
func isEscapePossible(blocked [][]int, source []int, target []int) bool { return true }
class Solution { public: bool isEscapePossible(vector<vector<int>>& blocked, vector<int>& source, vector<int>& target) { return true; } };
import collections
from typing import List

class Solution:
    def isEscapePossible(self, blocked: List[List[int]], source: List[int], target: List[int]) -> bool:
        return True
var isEscapePossible = function(blocked, source, target) { return true; };

Comments