Open yeonghwanjeon opened 5 years ago
다른 사람 풀이
for ~ else 구문 있음
class Solution:
# @return a string
def longestCommonPrefix(self, strs):
if not strs:
return ""
for i, letter_group in enumerate(zip(*strs)): if len(set(letter_group)) > 1: return strs[0][:i] else: return min(strs)
문제 풀이
worst case - O(n * m)