You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Probably need another test to confirm one is actually using prefixes - made a mistake in my first submission and this passed:
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
prefix = strs[0]
for s in strs:
while prefix and prefix not in s:
prefix = prefix[:-1]
if len(prefix) == 0:
return ""
return prefix
Activity