Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cdd9af

Browse files
refactor 994
1 parent5c8684d commit6cdd9af

File tree

1 file changed

+0
-32
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-32
lines changed

‎src/main/java/com/fishercoder/solutions/_994.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
importjava.util.LinkedList;
44
importjava.util.Queue;
55

6-
/**
7-
* 994. Rotting Oranges
8-
*
9-
* In a given grid, each cell can have one of three values:
10-
*
11-
* the value 0 representing an empty cell;
12-
* the value 1 representing a fresh orange;
13-
* the value 2 representing a rotten orange.
14-
* Every minute, any fresh orange that is adjacent (4-directionally) to a
15-
* rotten orange becomes rotten.
16-
* Return the minimum number of minutes that must elapse until no cell has a fresh orange.
17-
* If this is impossible, return -1 instead.
18-
*
19-
* Example 1:
20-
* Input: [[2,1,1],[1,1,0],[0,1,1]]
21-
* Output: 4
22-
*
23-
* Example 2:
24-
* Input: [[2,1,1],[0,1,1],[1,0,1]]
25-
* Output: -1
26-
* Explanation: The orange in the bottom left corner (row 2, column 0) is never rotten, because rotting only happens 4-directionally.
27-
*
28-
* Example 3:
29-
* Input: [[0,2]]
30-
* Output: 0
31-
* Explanation: Since there are already no fresh oranges at minute 0, the answer is just 0.
32-
*
33-
* Note:
34-
* 1 <= grid.length <= 10
35-
* 1 <= grid[0].length <= 10
36-
* grid[i][j] is only 0, 1, or 2.
37-
*/
386
publicclass_994 {
397
publicstaticclassSolution1 {
408
int[]directions =newint[]{0,1,0, -1,0};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp