1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-18 11:36:48 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 12:43:11 +08:00
parent 58bbdfd57c
commit 2b0511d272
10721 changed files with 8123 additions and 8119 deletions

View File

@@ -0,0 +1,28 @@
<p>Given a list of millions of words, design an algorithm to create the largest possible rectangle of letters such that every row forms a word (reading left to right) and every column forms a word (reading top to bottom). The words need not be chosen consecutively from the list but all rows must be the same length and all columns must be the same height.</p>
<p>If there are more than one answer, return any one of them. A word can be used more than once.</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> <code>[&quot;this&quot;, &quot;real&quot;, &quot;hard&quot;, &quot;trh&quot;, &quot;hea&quot;, &quot;iar&quot;, &quot;sld&quot;]</code>
<strong>Output:
</strong><code>[
&nbsp; &quot;this&quot;,
&nbsp; &quot;real&quot;,
&nbsp; &quot;hard&quot;</code>
]</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input:</strong> <code>[&quot;aa&quot;]</code>
<strong>Output: </strong>[&quot;aa&quot;,&quot;aa&quot;]</pre>
<p><strong>Notes: </strong></p>
<ul>
<li><code>words.length &lt;= 1000</code></li>
<li><code>words[i].length &lt;= 100</code></li>
<li>It&#39;s guaranteed that&nbsp;all the words are randomly generated.</li>
</ul>