Python 3 solution(sloved in 15 min)


#1

temp1=A
temp2=B
arr1=""

    while(temp1):
        arr1+=str(temp1.val)
        temp1=temp1.next
    arr1=arr1[::-1]
    int1=int(arr1)
    
    arr2=""
    while(temp2):
        arr2+=str(temp2.val)
        temp2=temp2.next
    arr2=arr2[::-1]
    int2=int(arr2)
    
    result=int1+int2
    arr3=str(result)
    arr3=arr3[::-1]
    int3=int(arr3)
    
    new=ListNode(arr3[0])
    curr=new
    for i in range(1,len(arr3)):
        curr.next=ListNode(arr3[i])
        curr=curr.next
    return(new)