14. Longest Common Prefix - LeetCode
class Solution:
def longestCommonPrefix(self, strs: list[str]) -> str:
result = []
for i, c in enumerate(strs[0]):
if not all([i < len(s) and c == s[i] for s in strs]):
break
result.append(c)
return ''.join(result)