Longest Common Prefix
来源:互联网 发布:mac如何打出罗马数字 编辑:程序博客网 时间:2024/05/18 18:47
Write a function to find the longest common prefix string amongst an array of strings.
class Solution {public: string longestCommonPrefix(vector<string> &strs) { string res; if (strs.empty()) return res; for (int i = 0; i < strs[0].length(); i++) { for (int j = 1; j < strs.size(); j++) if (i >= strs[j].length() || strs[0][i] != strs[j][i]) return res; res.push_back(strs[0][i]); } return res; }};
0 0
- LeetCode: Longest Common Prefix
- LeetCode Longest Common Prefix
- LeetCode : Longest Common Prefix
- [Leetcode] Longest Common Prefix
- leetcode6:Longest Common Prefix
- leetcode22: longest common prefix
- [LeetCode] Longest Common Prefix
- Leetcode14: Longest Common Prefix
- Longest Common Prefix
- Longest Common Prefix
- Longest Common Prefix
- [LeetCode]Longest Common Prefix
- Longest Common Prefix
- LeetCode-Longest Common Prefix
- Longest Common Prefix
- [LeetCode] Longest Common Prefix
- Longest Common Prefix
- LeetCode - Longest Common Prefix
- 编程算法基础-枚举与剪枝
- 堆的相关知识——创建堆
- ASP+与ASP有什么不同
- 显卡排名图(偶也是在网上看到的,特提供给广大网友)
- Python List、Dict等的sort与sorted排序
- Longest Common Prefix
- 计算机视觉方向的顶级会议、期刊
- System.Data.Linq中的一些简单函数的使用
- 腾讯2014年实习生招聘试题
- HDMI输入分辨率转换碰到的问题
- Video4Linux
- 公约数和公倍数
- Spring Aspect的Execution表达式
- 腾讯2014春季笔试题:double数的解析