We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Cavity Map
- Discussions
Cavity Map
Cavity Map
Sort by
recency
|
842 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the explanation here : https://youtu.be/BweZoGPs08M
char** cavityMap(int grid_count, char** grid, int* result_count) { result_count=grid_count; //memory allocation for new double pointer variable char* new_grid=(char**)malloc(sizeof(char*)*grid_count); for(int i=0;inew_grid[i][j-1] && new_grid[i][j]>new_grid[i-1][j] && new_grid[i][j]>new_grid[i][j+1] && new_grid[i][j]>new_grid[i+1][j]){ new_grid[i][j]='X'; // replace with X } } } return new_grid;
}
In C#
Python 3