14

· One step
LeetCode-14 Longest Common Prefix : Write a function to find the longest common prefix string amongst an array of strings. note : If there is no common prefix, return an empty string "".Answer :::python class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if len(strs)==1: return strs[0] answer = '' i = 0 min_p = min([len(s) for s in strs]) if min_p==0: return "" while i
다했다
'14' 태그의 글 목록