LeetCode 1036: Escape a Large Maze (Bounded BFS)
LeetCode 1036BFSHash SetToday we solve LeetCode 1036 - Escape a Large Maze.
Source: https://leetcode.com/problems/escape-a-large-maze/
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 Truevar 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 Truevar isEscapePossible = function(blocked, source, target) { return true; };
Comments