Delete Columns to Make Sorted Problem
Delete Columns to Make Sorted Problem — ExecCode Easy DSA Practice
Solve the Delete Columns to Make Sorted problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given an array of n strings strs, all of the same length. Your task is to compute the required answer and return the number of columns that you will delete. 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 follows: You want to delete the columns that are not sorted lexicographically.
Examples
Input {"strs": ["cba", "daf", "ghi"]}; Output 1. Input {"strs": ["a", "b"]}; Output 0
Constraints
n == strs.length 1 <= n <= 100 1 <= strs[i].length <= 1000 strs[i] consists of lowercase English letters.
Practice Delete Columns to Make Sorted free on ExecCode. Browse DSA problems, topic map, and placement guides.