diff --git a/Count Unguarded Cells in the Grid b/Count Unguarded Cells in the Grid new file mode 100644 index 0000000..79d4d63 --- /dev/null +++ b/Count Unguarded Cells in the Grid @@ -0,0 +1,12 @@ +class Solution { +public: + int countUnguarded(int m, int n, vector>& guards, vector>& 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; +… } +};