@@ -0,0 +1,1483 @@
+//https://www.hackerrank.com/challenges/cavity-map%0Aimport java.io.*;%0Aimport java.util.*;%0A%0Apublic class Solution%7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A        %0A        //Input%0A        byte N = Byte.parseByte(br.readLine());%0A        char%5B%5D%5B%5D matrix = new char%5BN%5D%5B%5D;%0A        for(byte i = 0; i %3C N; ++i)%7B%0A            matrix%5Bi%5D = br.readLine().toCharArray();%0A        %7D%0A        %0A        //Solve%0A        %0A        //Find cavities%0A        int max = N-1;%0A        List%3CByte%3E cavX = new ArrayList%3CByte%3E();%0A        List%3CByte%3E cavY = new ArrayList%3CByte%3E();%0A        for(byte y = 1; y %3C max; ++y)%7B%0A            for(byte x = 1; x %3C max; ++x)%7B%0A                char depth = matrix%5By%5D%5Bx%5D;%0A                if (depth %3E matrix%5By-1%5D%5Bx%5D%0A                    && depth %3E matrix%5By+1%5D%5Bx%5D%0A                    && depth %3E matrix%5By%5D%5Bx-1%5D%0A                    && depth %3E matrix%5By%5D%5Bx+1%5D%0A                )%7B%0A                    cavY.add(y);%0A                    cavX.add(x);%0A                %7D%0A            %7D%0A        %7D%0A        %0A        //Mark cavities%0A        int size = cavY.size();%0A        for(int i = 0; i %3C size; ++i)%7B%0A            matrix%5BcavY.get(i)%5D%5BcavX.get(i)%5D = 'X';%0A        %7D%0A        %0A        //Output%0A        StringBuffer sb = new StringBuffer();%0A        for(byte i = 0; i %3C N; ++i)%7B%0A            sb.append(new String(matrix%5Bi%5D));%0A            sb.append(%22%5Cn%22);%0A        %7D%0A        System.out.print(sb);%0A    %7D%0A%7D%0A

Create cavity-map.java