[AtCoder] E - Change a Little BitRead more
[AtCoder] B - Fusing SlimesRead more
[AtCoder] F - Enclose AllRead more
[AtCoder] D - Swap and FlipRead more
[Codeforces] Round #124 (Div. 2) A. Plate GameRead more
[Codeforces] Abbyy Cup 2.0 - Final (unofficial) A1. Beaver`s Calculator 1.0Read more
[Codeforces] Round #114 (Div. 1) A. Wizards and TrolleybusesRead more
[Codeforces] Round #115 C. Geometry HorseRead more
[Codeforces] Round #112 (Div. 2) C. Another Problem on StringsRead more
[LeetCode] Delete Columns to Make Sorted

944. Delete Columns to Make Sorted

You are given an array of n strings strs, all of the same length.

The strings can be arranged such that there is one on each line, making a grid. For example, strs = [“abc”, “bce”, “cae”] can be arranged as:

1
2
3
abc
bce
cae

You want to delete the columns that are not sorted lexicographically. In the above example (0-indexed), columns 0 (‘a’, ‘b’, ‘c’) and 2 (‘c’, ‘e’, ‘e’) are sorted while column 1 (‘b’, ‘c’, ‘a’) is not, so you would delete column 1.

Return the number of columns that you will delete.

Read more