rows of strings that all have the same length. Written one under another, they form a grid of letters.
A column is sorted if its letters, read top to bottom, are in alphabetical order (equal neighbours are allowed). Return how many columns of the grid are **not** sorted.rows=['bad', 'cab', 'dog'] → 1
Reading top to bottom, the columns are "bcd", "aao" and "dbg". Only the last one is out of order.
rows=['zy', 'ax'] → 2
The first column goes z → a and the second y → x, so both break alphabetical order.
rows=['q'] → 0
A column with a single letter is always in order.
rows=['bad', 'cab', 'dog']
1
Run checks the first 3 tests in your browser. Submit checks all 93 tests on the server, hidden ones included.