题目摘要
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 “”。
所有输入只包含小写字母 a-z
思路
- 循环比较当前公共前缀和后一个字符串的公共前缀。
- 如果当前公共前缀为
""
则停止循环 - 每次比较两个字符串的如果对应字符不同则停止,之前的即为公共前缀。
代码
1 | class Solution { |
文章导航
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 “”。
所有输入只包含小写字母 a-z
""
则停止循环1 | class Solution { |
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true
2019-06-13
#leetcode
2019-05-28
#leetcode
2019-05-27
#leetcode
2019-05-26
#leetcode
2019-05-25
#leetcode
2018-07-25
#Golang#leaf
2018-07-09
#正则表达式
2018-07-06
#shell
2018-07-03
#shell
2018-05-25
#shell
2018-05-24
#shell
2018-05-19
#shell
2018-05-03
2018-04-11
#游戏AI
2018-03-27
#游戏AI
2018-02-13
#Golang
2018-02-13
#Golang
2018-02-13
#Golang
2018-02-05
#Vim
2018-02-01
#Linux学习#个人笔记
2018-01-31
#Vim
2018-01-23
#游戏开发#AI行为树
2018-01-22
#Linux学习#个人笔记
2018-01-17
#linux学习
2018-01-17
#vim
2018-01-13
#linux学习#vim安装
2018-01-06
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go基础
2018-01-04
#Golang#Go常用包#包函数
2018-01-03
#Golang#Go常用包#包函数
2017-12-30
#博客搭建