mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
国外版
This commit is contained in:
28
算法题(国外版)/longest-common-prefix.html
Normal file
28
算法题(国外版)/longest-common-prefix.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<p>Write a function to find the longest common prefix string amongst an array of strings.</p>
|
||||
|
||||
<p>If there is no common prefix, return an empty string <code>""</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> strs = ["flower","flow","flight"]
|
||||
<strong>Output:</strong> "fl"
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> strs = ["dog","racecar","car"]
|
||||
<strong>Output:</strong> ""
|
||||
<strong>Explanation:</strong> There is no common prefix among the input strings.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= strs.length <= 200</code></li>
|
||||
<li><code>0 <= strs[i].length <= 200</code></li>
|
||||
<li><code>strs[i]</code> consists of only lower-case English letters.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user