You are viewing a single comment's thread. Return to all comments →
My Java 8 Solution
public static String gridChallenge(List<String> grid) { for (int i = 0; i < grid.size(); i++) { char[] ca = grid.get(i).toCharArray(); Arrays.sort(ca); grid.set(i, String.valueOf(ca)); } for (int j = 0; j < grid.get(0).length(); j++) { for (int i = 1; i < grid.size(); i++) { if (grid.get(i).charAt(j) < grid.get(i - 1).charAt(j)) return "NO"; } } return "YES"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Grid Challenge
You are viewing a single comment's thread. Return to all comments →
My Java 8 Solution