Skip to content

Commit

Permalink
Create Count Unguarded Cells in the Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhiupman568 authored Nov 21, 2024
1 parent 4e7f8b3 commit 949fed6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Count Unguarded Cells in the Grid
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Solution {
public:
int countUnguarded(int m, int n, vector<vector<int>>& guards, vector<vector<int>>& walls) {
// Initialize grid with zeros
int g[m][n];
memset(g, 0, sizeof(g));

// Mark guards and walls as 2
for (auto& e : guards) {
g[e[0]][e[1]] = 2;
… }
};

0 comments on commit 949fed6

Please sign in to comment.