Delete Columns to Make Sorted
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given strs, a list of n lowercase strings that all have the same length. Stack them
vertically so that the characters at index j of every string form column j.
A column is **sorted** if its characters, read from top (first string) to bottom (last string), never
decrease in alphabetical order. Equal adjacent characters are fine.
Return the number of columns that are **not** sorted, i.e. how many columns you would have to delete
so that every remaining column is sorted.
Examples
Constraints
- 1 <= strs.length <= 100
- 1 <= strs[i].length <= 1000
- All strings in `strs` have the same length
- `strs[i]` consists of lowercase English letters
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.