dsa · easy

Add Binary

a and b are binary integers given as strings of 0 and 1 (no extra leading zeros except the number 0 itself). Return their sum as a binary string.

Arguments

Example

a = "11", b = "1""100" because 3 + 1 = 4.

Constraints

1 <= a.length, b.length <= 4*10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
"11"
"1"

Expected:
100

Example 2

Input:
"1010"
"1011"

Expected:
10101

Open in the Dojo editor