longestCommonPrefix

Run Settings
LanguagePython
Language Version
Run Command
class Solution: def longestCommonPrefix(self, strs): result = "" check = sorted(strs, key = lambda x: len(x)) check = check[0] for i in range(len(check)): flag = 0 for j in strs: if j[i] != check[i]: flag = 1 break if flag == 0: result += check[i] else: return result return result
Editor Settings
Theme
Key bindings
Full width
Lines