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.
for loops will exclude all elements at the edge (Only - elements in the following diagram)
++++++---++---++---++++++
check all the inner elements' left, right, upper and lower elements. If these elements are smaller than the center element, change it to Integer.MAX_INT.
While printing, simply print X if Integer.MAX_INT is encountered. ;)
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 →
for loops will exclude all elements at the edge (Only - elements in the following diagram)
check all the inner elements' left, right, upper and lower elements. If these elements are smaller than the center element, change it to Integer.MAX_INT.
While printing, simply print X if Integer.MAX_INT is encountered. ;)