You are viewing a single comment's thread. Return to all comments →
C#
public static string gridChallenge(List<string> grid) { const string YES = "YES"; const string NO = "NO"; var rowSize = grid.Count - 1; var columnSize = grid.First().Length; var horizontallyOrderedNumericRows = grid.Select(st => st.Select(ch => (int)ch).Order().ToArray()).ToArray(); for (int i = 0; i < columnSize; i++) { for (int j = 0; j < rowSize; j++) { if (horizontallyOrderedNumericRows[j][i] > horizontallyOrderedNumericRows[j + 1][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 →
C#