You are viewing a single comment's thread. Return to all comments →
public static String gridChallenge(List<String> grid) { for (int i=0; i<grid.size(); i++) { char[] charArr = grid.get(i).toCharArray(); Arrays.sort(charArr); String str = new String(charArr); grid.set(i, str); } for (int i=0; i<grid.get(0).length(); i++) { int charVal = 'a'; for (String string : grid) { if (string.charAt(i) < charVal) return "NO"; charVal = string.charAt(i); } } 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 →
Java 8