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