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.
vector<string>cavityMap(vector<string>arr){intn=arr.size();for(inti=1;i<n-1;i++)//ignoring first and last rows{for(intj=1;j<n-1;j++)//ignoring first and last columns{if(arr[i][j]-48>arr[i-1][j]-48&&arr[i][j]-48>arr[i+1][j]-48&&arr[i][j]-48>arr[i][j-1]-48&&arr[i][j]-48>arr[i][j+1]-48)arr[i][j]='X';}}returnarr;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cavity Map
You are viewing a single comment's thread. Return to all comments →