Py solution O(n) time using 3 pointers


#1

class Solution:
# @param A : list of integers
# @param B : list of integers
# @param C : list of integers
# @return an integer
def solve(self, A, B, C):
a=len(A)
b=len(B)
c=len©
i,j,k=0,0,0
ans=max(A[0],B[0],C[0])-min(A[0],B[0],C[0])
while i<a or j<b or k<c:

        ans=min(ans,max(A[i],B[j],C[k])-min(A[i],B[j],C[k]))
        
        if A[i]==min(A[i],B[j],C[k]) and i<a-1:
            i+=1
        elif B[j]==min(A[i],B[j],C[k]) and j<b-1:
            j+=1
        elif C[k]==min(A[i],B[j],C[k]) and k<c-1:
            k+=1
        else:
            
            break
    return ans