Binary Sum
Computers store numbers in binary, using only 0 and 1. Given two binary strings a and b, add them as numbers. Return the result as a binary string.
Примеры
Ввод
"11", "1"Вывод
"100"Ввод
"1010", "1011"Вывод
"10101"Ввод
"0", "0"Вывод
"0"Нужно реализовать
def add_binary(a: str, b: str) -> str:
Теги
stringsmath
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
PieslēgtiesVisible tests
1
Input
"11", "1"Expected
"100"2
Input
"1010", "1011"Expected
"10101"3
Input
"0", "0"Expected
"0"4
Input
"1", "1"Expected
"10"5
Input
"100", "110010"Expected
"110110"6
Input
"11", "11"Expected
"110"Focus radio
Paused · SomaFM · Fluid