There was an error while loading. Please reload this page.
1 parent f33695e commit a385b4eCopy full SHA for a385b4e
1 file changed
src/main/java/com/thealgorithms/datastructures/graphs/RottingOranges.java
@@ -99,11 +99,7 @@ public int run(int[][] grid) {
99
int newRow = current.row + DEL_ROW[i];
100
int newCol = current.col + DEL_COL[i];
101
102
- if (newRow >= 0
103
- && newRow < rows
104
- && newCol >= 0
105
- && newCol < cols
106
- && copy[newRow][newCol] == 1) {
+ if (newRow >= 0 && newRow < rows && newCol >= 0 && newCol < cols && copy[newRow][newCol] == 1) {
107
108
copy[newRow][newCol] = 2;
109
rottedFresh++;
@@ -115,4 +111,4 @@ public int run(int[][] grid) {
115
111
116
112
return rottedFresh == freshOranges ? minutes : -1;
117
113
}
118
-}
114
+}
0 commit comments