package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/cavity-map
 */
public class CavityMap {
    private static void cavityMap(char[][] matrix) {
        // TODO
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        char[][] matrix = new char[n][n];
        for (int i = 0; i < n; i++) {
            String str = in.next();
            matrix[i] = str.toCharArray();
        }
        cavityMap(matrix);
    }
}

@@ -191,15 +191,573 @@
     
-// TODO
+for (int row = 1; row %3C matrix.length - 1; row++) %7B%0A            for (int col = 1; col %3C matrix%5Brow%5D.length - 1; col++) %7B%0A                int val = matrix%5Brow%5D%5Bcol%5D;%0A                if (matrix%5Brow - 1%5D%5Bcol%5D %3C val &&%0A                    matrix%5Brow + 1%5D%5Bcol%5D %3C val &&%0A                    matrix%5Brow%5D%5Bcol - 1%5D %3C val &&%0A                    matrix%5Brow%5D%5Bcol + 1%5D %3C val) %7B%0A                    matrix%5Brow%5D%5Bcol%5D = 'X';%0A                %7D%0A            %7D%0A        %7D%0A        for (int i = 0; i %3C matrix.length; i++) %7B%0A            System.out.println(new String(matrix%5Bi%5D));%0A        %7D
 %0A   

Solve Cavity Map