c++ BFS
\nclass Solution {\n    bool safe(int newX, int newY, int m, int n) {\n        return newX >= 0 && newX < m && newY >= 0 && newY < n;\n    }\npublic:\n    vecto
```\nclass Solution {\n    bool safe(int newX, int newY, int m, int n) {\n        return newX >= 0 && newX < m && newY >= 0 && newY < n;\n    }\npublic:\n    vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {\n        vector<pair<int, int>> dirs = {\n            {-1, 0},\n            {0, 1},\n            {1, 0},\n            {0, -1}\n        };\n        \n        queue<pair<int, int>> q;\n        int m = isWater.size();\n        int n = isWater[0].size();\n        vector<vector<bool>> visited(m, vector<bool>(n, 0));\n        for (int i = 0; i < m; i++) {\n            for (int j = 0; j < n; j++) {\n                if (isWater[i][j] == 1) {\n                    isWater[i][j] = 0;\n                    visited[i][j] = true;\n                    q.push({i, j});\n                }\n            }\n        }\n        \n        while (!q.empty()) {\n            pair<int, int> topVal = q.front();\n            q.pop();\n            int x = topVal.first, y = topVal.second;\n            visited[x][y] = true;\n            for (auto& dir : dirs) {\n                int newX = x + dir.first;\n                int newY = y + dir.second;\n                if (safe(newX, newY, m, n) && !visited[newX][newY]) {\n                    isWater[newX][newY] = isWater[x][y] + 1;\n                    visited[newX][newY] = true;\n                    q.push({newX, newY});\n                }   \n            }\n        }\n        \n        return isWater;\n    }\n};\n```
['Breadth-First Search', 'C']