leetcode_gym/_code/bit manipulation/addBinaryStrings.py
2026-08-25 19:14:07 -06:00

14 lines
196 B
Python

# print( bin(4).replace("0b", "") )
a = "1010"
b = "1011"
decA = int(a, 2)
decB = int(b, 2)
print(decA, decB, decA+decB, bin(decA+decB))
res = bin( decA + decB ).replace("0b", "")
print(res)