示例 1:
输入: [“flower”,”flow”,”flight”]
输出: “fl”
示例 2:
输入: [“dog”,”racecar”,”car”]
输出: “”
解释: 输入不存在公共前缀。
第一种:
class Solution {
public String longestCommonPrefix(String[] strs) {
int amount = strs.length;
if (amount==0) return “”;
int len = strs[0].length();
for(int i=1;i