You are viewing a single comment's thread. Return to all comments →
C#
public static string gridChallenge(List<string> grid) { for (int i = 0; i < grid.Count(); i++) { char[] characters = grid[i].ToArray(); Array.Sort(characters); grid[i] = new string(characters); } bool alphaOrder = true; if (grid.Count > 1) { for (int i = 0; i < grid.Count() - 1; i++) { for (int j = 0; j < grid[0].Count(); j++) { if (String.Compare(grid[i].Substring(j, 1), grid[i + 1].Substring(j, 1)) > 0) { alphaOrder = false; } } } } return alphaOrder ? "YES" : "NO"; }
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 →
C#