Write a function to find the longest common prefix string amongst an array of strings.
讓計算數(shù)組所有字符串的公共prefix, 剛開始還以為兩個就算common prefix
既然所有, 按排序,查看第一個和最后一個就可以了, 邊界條件要判斷好。
發(fā)現(xiàn)easy的題都不難, 但是要考慮好臨界值, 一定要冷靜, 不能慌!

Write a function to find the longest common prefix string amongst an array of strings.
讓計算數(shù)組所有字符串的公共prefix, 剛開始還以為兩個就算common prefix
既然所有, 按排序,查看第一個和最后一個就可以了, 邊界條件要判斷好。
發(fā)現(xiàn)easy的題都不難, 但是要考慮好臨界值, 一定要冷靜, 不能慌!