[C++]BFS - Easy to Understand - O(M x N)
Time Complexity: O(M x N)\n\n```\nclass Solution {\npublic:\n\n    vector> highestPeak(vector>& isWater) {\n        int r = isWater.size();\n        int c = isW
**Time Complexity: O(M x N)**\n\n```\nclass Solution {\npublic:\n\n    vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {\n        int r = isWater.size();\n        int c = isWater[0].size();\n        queue <pair<int,int>> curr;\n        \n        for (int i = 0; i < r; i++) {\n            for (int j = 0; j < c; j++) {\n                //set the land cell to -1 (not visited)\n                if (isWater[i][j] == 0) {\n                    isWater[i][j] = -1;\n                }\n                //set the water cell to zero and to queue\n                else {\n                    isWater[i][j] = 0;\n                    curr.push({i, j});\n                }\n            }\n        }\n        \n        int hill = 0;\n        while (!curr.empty()) {\n            int len = curr.size();\n            \n            for (int k = 0; k < len; k++) {\n                \n                //for each cell check its 4 boundary cells\n                //if it is not visited, increase its hill by 1\n                pair <int, int> fnt = curr.front(); curr.pop();\n                int i = fnt.first, j = fnt.second;\n                \n                //top cell\n                if (i > 0 && isWater[i - 1][j] == -1) {\n                    isWater[i - 1][j] = hill + 1;\n                    curr.push({i-1, j});\n                }\n                //bottom cell\n                if ((i < r - 1) && (isWater[i + 1][j] == -1)) {\n                    isWater[i + 1][j] = hill + 1;\n                    curr.push({i+1, j});\n                }\n                //left cell\n                if (j > 0 && (isWater[i][j - 1] == -1)) {\n                    isWater[i][j - 1] = hill + 1;\n                    curr.push({i, j-1});\n                }\n                //right cell\n                if ((j < c - 1) && (isWater[i][j + 1] == -1)) {\n                    isWater[i][j + 1] = hill + 1;\n                    curr.push({i, j+1});\n                }\n            }\n            \n            //after 1 complete round increase the height of the hill\n            hill += 1;\n        }\n        \n        return isWater;\n    }\n};
['Breadth-First Search', 'C', 'C++']