Leetcode - 14. Longest Common Prefix
It has been 1141 days since the last update, the content of the article may be outdated.
此篇文章為我的解題紀錄,程式碼或許並不是很完善
Leetcode - 14. Longest Common Prefix
解題思路
一開始先用字串長度將陣列排序好,確保第一個字串的長度是最短的
用str[0]
內的每個字元下去跑,如果他存在在strs陣列裡的每個字,則一直跑到不相等為止
我滴程式碼
python
1 | class Solution: |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment
GitalkFacebook Comments
未找到相關的 Issues
請聯絡 @essen900718 初始化評論