1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-06 07:51:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,6 +1,10 @@
<p>You are given an array of <code>n</code> strings <code>strs</code>, all of the same length.</p>
<p>The strings can be arranged such that there is one on each line, making a grid. For example, <code>strs = [&quot;abc&quot;, &quot;bce&quot;, &quot;cae&quot;]</code> can be arranged as:</p>
<p>The strings can be arranged such that there is one on each line, making a grid.</p>
<ul>
<li>For example, <code>strs = [&quot;abc&quot;, &quot;bce&quot;, &quot;cae&quot;]</code> can be arranged as follows:</li>
</ul>
<pre>
abc
@@ -8,12 +12,12 @@ bce
cae
</pre>
<p>You want to <strong>delete</strong> the columns that are <strong>not sorted lexicographically</strong>. In the above example (0-indexed), columns 0 (<code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>) and 2 (<code>&#39;c&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;e&#39;</code>) are sorted while column 1 (<code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>, <code>&#39;a&#39;</code>) is not, so you would delete column 1.</p>
<p>You want to <strong>delete</strong> the columns that are <strong>not sorted lexicographically</strong>. In the above example (<strong>0-indexed</strong>), columns 0 (<code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>) and 2 (<code>&#39;c&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;e&#39;</code>) are sorted, while column 1 (<code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>, <code>&#39;a&#39;</code>) is not, so you would delete column 1.</p>
<p>Return <em>the number of columns that you will delete</em>.</p>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> strs = [&quot;cba&quot;,&quot;daf&quot;,&quot;ghi&quot;]
@@ -25,7 +29,7 @@ cae
Columns 0 and 2 are sorted, but column 1 is not, so you only need to delete 1 column.
</pre>
<p><strong>Example 2:</strong></p>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> strs = [&quot;a&quot;,&quot;b&quot;]
@@ -36,7 +40,7 @@ Columns 0 and 2 are sorted, but column 1 is not, so you only need to delete 1 co
Column 0 is the only column and is sorted, so you will not delete any columns.
</pre>
<p><strong>Example 3:</strong></p>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> strs = [&quot;zyx&quot;,&quot;wvu&quot;,&quot;tsr&quot;]