Skip to content

Commit 739e083

Browse files
authored
Update minimum-time-takes-to-reach-destination-without-drowning.cpp
1 parent 202828b commit 739e083

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

C++/minimum-time-takes-to-reach-destination-without-drowning.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ class Solution {
1919
}
2020
}
2121
}
22-
q.emplace_back(i0, j0, 0);
22+
q.emplace_back(i0, j0, 1);
23+
lookup[i0][j0] = 1;
2324
while (!empty(q)) {
2425
vector<tuple<int, int, int>> new_q;
2526
for (const auto& [i, j, d] : q) {
2627
if (land[i][j] == "D") {
27-
return d;
28+
return d - 1;
2829
}
2930
for (const auto& [di, dj] : DIRECTIONS) {
3031
const int ni = i + di, nj = j + dj;

0 commit comments

Comments
 (0)