1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最长公共前缀 [longest-common-prefix].html
2022-03-29 12:43:11 +08:00

30 lines
741 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>编写一个函数来查找字符串数组中的最长公共前缀。</p>
<p>如果不存在公共前缀,返回空字符串&nbsp;<code>""</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>strs = ["flower","flow","flight"]
<strong>输出:</strong>"fl"
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>strs = ["dog","racecar","car"]
<strong>输出:</strong>""
<strong>解释:</strong>输入不存在公共前缀。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= strs.length &lt;= 200</code></li>
<li><code>0 &lt;= strs[i].length &lt;= 200</code></li>
<li><code>strs[i]</code> 仅由小写英文字母组成</li>
</ul>