Simple Python_Solution O(n)


#1
 def solve(self,s1,s2):
    i=0
    j=0
    res=""
    while i<len(s1) and j<len(s2):
        if s1[i]==s2[j]:
            res+=s1[i]
        else:
            break
        i+=1
        j+=1
    return res
def longestCommonPrefix(self, A):
    p=A[0]
    for  i in range(1,len(A)):
        p=self.solve(p,A[i])
    return p

#2
def lonprefix(A,B):
s=""
for i in range(min(len(A),len(B))):
    if A[i]==B[i]:
        s=s+A[i]
    else:
        return s
    
    
class Solution:
# @param A : list of strings
# @return a strings
def longestCommonPrefix(self, A):
    p=A[0]
    for i in range(1,len(A)):
        #p=lonprefix(A[i],A[i+1])
        p=lonprefix(p,A[i])
        
    return p

why I am getting an error object of type ‘NoneType’ has no len() ?