Longest Common Prefix

Solution
Verifying access...

Time Complexity

O(N * M)SPACE_COMPLEXITY: O(1)---PYTHON---class Solution:def longestCommonPrefix(self, strs: List[str]) -> str:if not strs:return ""for i in range(len(strs[0]):

Space Complexity

O(1)---PYTHON---class Solution:def longestCommonPrefix(self, strs: List[str]) -> str:if not strs:return ""for i in range(len(strs[0]):