@@ -0,0 +1,1661 @@
+/**%0A * %0A */%0Apackage algorithms.implementation;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Scanner;%0A%0A/**%0A * Challenge: https://www.hackerrank.com/challenges/cavity-map%0A * %0A * @author Sudharsanan Muralidharan%0A */%0Apublic class CavityMap %7B%0A%0A  private static boolean compare(char c, char c2) %7B%0A    return Integer.parseInt(String.valueOf(c)) %3E Integer.parseInt(String.valueOf(c2));%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A    int n = in.nextInt();%0A    char%5B%5D characters = new char%5Bn * n%5D;%0A%0A    for (int i = 0; i %3C n; i++) %7B%0A      String input = in.next();%0A      for (int j = 0; j %3C input.length(); j++) %7B%0A        characters%5B(i * n) + j%5D = input.charAt(j);%0A      %7D%0A    %7D%0A%0A    List%3CInteger%3E indexes = new ArrayList%3CInteger%3E();%0A%0A    for (int i = 1; i %3C characters.length - 1; i++) %7B%0A      if (i %25 n == 0 %7C%7C ((i + 1) %25 n) == 0) %7B%0A        continue;%0A      %7D%0A      int top = i - n;%0A      int bottom = i + n;%0A      boolean greater = false;%0A%0A      if (top %3E 0 && bottom %3C characters.length) %7B%0A        greater = compare(characters%5Bi%5D, characters%5Btop%5D);%0A        greater = greater && compare(characters%5Bi%5D, characters%5Bbottom%5D);%0A        greater = greater && compare(characters%5Bi%5D, characters%5Bi - 1%5D);%0A        greater = greater && compare(characters%5Bi%5D, characters%5Bi + 1%5D);%0A      %7D%0A%0A      if (greater) %7B%0A        indexes.add(i);%0A      %7D%0A    %7D%0A%0A    for (Integer index : indexes) %7B%0A      characters%5Bindex%5D = 'X';%0A    %7D%0A%0A    for (int i = 0; i %3C characters.length; i++) %7B%0A      if (i %3E 0 && i %25 n == 0) %7B%0A        System.out.println();%0A      %7D%0A      System.out.print(characters%5Bi%5D);%0A    %7D%0A%0A    in.close();%0A  %7D%0A%7D%0A

Add solution for CavityMap hackerrank problem