{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "5ac00270616644e09618039fd1ded545", "keywords": "字符串", "title": "最长公共前缀", "desc": [ { "content": "\n
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 \"\"
。
示例 1:
输入:strs = [\"flower\",\"flow\",\"flight\"]
输出:\"fl\"
示例 2:
输入:strs = [\"dog\",\"racecar\",\"car\"]
输出:\"\"
解释:输入不存在公共前缀。
提示:
0 <= strs.length <= 200
0 <= strs[i].length <= 200
strs[i]
仅由小写英文字母组成