Skip to content

Commit 97b4132

Browse files
authored
Update minimum-number-of-days-to-disconnect-island.cpp
1 parent 06d499a commit 97b4132

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

C++/minimum-number-of-days-to-disconnect-island.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ class Solution {
4646
(*lookup)[i][j] = 1;
4747
while (!stk.empty()) {
4848
auto [i, j] = stk.back(); stk.pop_back();
49-
for (const auto [di, dj] : directions) {
50-
const auto [ni, nj] = pair(i + di, j + dj);
51-
49+
for (const auto& [di, dj] : directions) {
50+
const auto& [ni, nj] = pair(i + di, j + dj);
5251
if (!(0 <= ni && ni < grid.size() &&
5352
0 <= nj && nj < grid[0].size() &&
5453
grid[ni][nj] &&

0 commit comments

Comments
 (0)