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