From 89efd7c83a3092a337f07dfacbebdd3be0d8d97e Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Wed, 28 Oct 2026 13:45:03 +0800 Subject: [PATCH] =?UTF-8?q?Update=2013.=20=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E7=9A=84=E8=BF=90=E5=8A=A8=E8=8C=83=E5=9B=B4.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。 --- notes/13. 机器人的运动范围.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/notes/13. 机器人的运动范围.md b/notes/13. 机器人的运动范围.md index dd96086e..58066d50 100644 --- a/notes/13. 机器人的运动范围.md +++ b/notes/13. 机器人的运动范围.md @@ -1,6 +1,6 @@ # 13. 机器人的运动范围 -[牛客网](https://www.nowcoder.com/practice/6e5207314b5241fb83f2329e89fdecc8?tpId=13&tqId=11219&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github) +[Leetcode](https://leetcode.cn/problems/ji-qi-ren-de-yun-dong-fan-wei-lcof/) ## 题目描述 @@ -14,20 +14,20 @@ ```java private static final int[][] next = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}}; -private int cnt = 0; +private int res = 0; private int rows; private int cols; private int threshold; private int[][] digitSum; -public int movingCount(int threshold, int rows, int cols) { - this.rows = rows; - this.cols = cols; - this.threshold = threshold; +public int wardrobeFinishing(int m, int n, int cnt) { + this.rows = m; + this.cols = n; + this.threshold = cnt; initDigitSum(); boolean[][] marked = new boolean[rows][cols]; dfs(marked, 0, 0); - return cnt; + return res; } private void dfs(boolean[][] marked, int r, int c) { @@ -36,7 +36,7 @@ private void dfs(boolean[][] marked, int r, int c) { marked[r][c] = true; if (this.digitSum[r][c] > this.threshold) return; - cnt++; + res++; for (int[] n : next) dfs(marked, r + n[0], c + n[1]); }