Skip to content

Commit

Permalink
Update bricks-falling-when-hit.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Mar 18, 2018
1 parent 26bbe4a commit 96f2609
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions C++/bricks-falling-when-hit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class Solution {

vector<int> result;
for (int i = hits.size() - 1; i >= 0; --i) {
int r = hits[i][0], c = hits[i][1];
const auto r = hits[i][0], c = hits[i][1];
const auto prev_roof = union_find.top();
if (grid[r][c] == 0) {
result.emplace_back(0);
continue;
}
for (const auto& d : directions) {
int nr = r + d.first, nc = c + d.second;
const auto nr = r + d.first, nc = c + d.second;
if (0 <= nr && nr < R &&
0 <= nc && nc < C &&
hit_grid[nr][nc]) {
Expand Down

0 comments on commit 96f2609

Please sign in to comment.