Simple Python solution without using any inbuilt libraries


#1
    carry = 0
    res = ""
    if len(A) > len(B):
        l = len(A)
        B = ('0'*(l-len(B)) + B)
    else:
        l = len(B)
        A = ('0'*(l-len(A)) + A)
    for i in range(l-1,-1,-1):
        sum = int(A[i]) + int(B[i]) + carry
        if sum == 0 or sum == 1:
            res += str(sum)
            carry = 0
        elif sum == 2:
            carry = 1
            res += str(0)
        else:
            carry = 1
            res += str(1)
    if carry == 1:
        res += str(1)
    return res[::-1]