Leetcode no. 14
来源:互联网 发布:大数据前沿技术应用 编辑:程序博客网 时间:2024/06/05 06:30
14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
public class Solution { public String longestCommonPrefix(String[] strs) { if (strs.length==0) return ""; String s= strs[0]; for (int i = 1; i < strs.length; i++) { while (strs[i].indexOf(s)!=0) s=s.substring(0,s.length()-1); } return s; }}
0 0
- Leetcode no. 14
- Leetcode NO.14 Longest Common Prefix
- LeetCode--No.14--Longest Common Prefix
- LeetCode No.11 ~No.12
- Leetcode NO.78 Subsets
- Leetcode NO.77 Combinations
- Leetcode NO.46 Permutations
- 【leetcode】No. 235 LCABST
- LeetCode no. 35
- Leetcode no. 37
- Leetcode no. 279
- Leetcode no. 335
- Leetcode no. 283
- Leetcode no. 181 (sql)
- Leetcode no. 40
- Leetcode no. 238
- Leetcode no. 26
- Leetcode no. 80
- VC++ 动态链接库编程
- 几分钟时间,搞清开源许可证之间的区别
- muduo网络库学习笔记(6):单例类(线程安全的)
- 代理详解 传值
- android中Root权限的判断与获取
- Leetcode no. 14
- Mysql和Oracle数据库sql执行过程的区别
- Linux Centos 6.5 安装FFMPEG && 故障排查
- Linux kernel 的 sendfile 是如何提高性能的
- IP地址0.0.0.0是什么意思?
- 上一周的知识点总结以及思路的理解
- Spring+MyBatis多数据源配置实现
- c++调用python发送邮件
- Leetcode 290. Word Pattern