@@ -0,0 +1,1642 @@
+//https://www.codewars.com/kata/550f22f4d758534c1100025a%0A/*%0ADescription:%0AOnce upon a time, on a way through the old wild west,%E2%80%A6%0A%E2%80%A6 a man was given directions to go from one point to another. The directions were %22NORTH%22, %22SOUTH%22, %22WEST%22, %22EAST%22. Clearly %22NORTH%22 and %22SOUTH%22 are opposite, %22WEST%22 and %22EAST%22 too. Going to one direction and coming back the opposite direction is a needless effort. Since this is the wild west, with dreadfull weather and not much water, it's important to save yourself some energy, otherwise you might die of thirst!%0AHow I crossed the desert the smart way.%0AThe directions given to the man are, for example, the following:%0A%5B%22NORTH%22, %22SOUTH%22, %22SOUTH%22, %22EAST%22, %22WEST%22, %22NORTH%22, %22WEST%22%5D.%0ATask:%0AWrite a function dirReduc which will take an array of strings and returns an array of strings with the needless directions removed (W%3C-%3EE or S%3C-%3EN side by side).%0A*/%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0A%0Apublic class DirReduction %7B%0A    public static String%5B%5D dirReduc(String%5B%5D arr) %7B%0A      ArrayList%3CString%3E list = new ArrayList%3C%3E(Arrays.asList(arr));%0A      for (int i = 0; i + 1 %3C list.size(); ++i) %7B%0A        if (i %3E= 0 && isRedundant(list.get(i), list.get(i + 1))) %7B%0A          list.remove(i);  %0A          list.remove(i);%0A          i = i - 2;%0A        %7D%0A      %7D%0A      return list.toArray(new String%5Blist.size()%5D);%0A    %7D%0A        %0A    private static boolean isRedundant (String a, String b) %7B%0A      return (a.equals(%22NORTH%22) && b.equals(%22SOUTH%22)) %7C%7C %0A        (a.equals(%22EAST%22) && b.equals(%22WEST%22)) %7C%7C%0A        (a.equals(%22SOUTH%22) && b.equals(%22NORTH%22)) %7C%7C %0A        (a.equals(%22WEST%22) && b.equals(%22EAST%22));%0A    %7D%0A%7D%0A

Create DirReduction.java