网友yzj518分享:
还有 徽章
Attention:python语言
- class Solution:
- """
- @param arr: the map
- @return: the smallest target that satisfies from the upper left corner (0, 0) to the lower right corner (n-1, n-1)
- """
- def __init__(self):
- self.vis = [[0 for i in range(108)] for i in range(105)];
- self.m = 0;
- def mapJump(self, arr):
- # Write your code here.
- n = len(arr);
- l = 0;
- r = 100000;
- while l <= r:
- self.m = (l + r) >> 1;
- for i in range(0,len(arr)):
- for j in range(0,len(arr)):
- self.vis[i][j] = 0;
- self.dfs(0, 0, arr);
- if self.vis[n – 1][n – 1] == 1:
- ans = self.m;
- r = self.m – 1;
- else:
- l = self.m + 1;
- return ans;
- def dfs(self, x, y, arr):
- dx = [0, 0, 1, -1];
- dy = [1, -1, 0, 0];
- self.vis[x][y] = 1;
- for i in range(0, 4):
- sx = x + dx[i];
- sy = y + dy[i];
- if sx >= len(arr) or sy >= len(arr) or sx < 0 or sy < 0:
- continue;
- if abs(arr[x][y] – arr[sx][sy]) > self.m or self.vis[sx][sy] == 1:
- continue;
- self.dfs(sx, sy, arr);
复制代码
网友z123z分享:
实物还是什么
网友wo56455分享:
实物还是什么
勋章好像是白金的。我听群里说的
网友hongxiu分享:
大佬怎么用