Given two binary strings a and b, return their sum as a binary string.
Example 1
Input: num1 = 1010, num2 = 1011
Output: 10101
Explanation: "1010" is 10 and "1011" is 11 in decimal. 10 + 11 = 21, which is written as "10101" in binary.
Example 2
Input: num1 = 11, num2 = 1
Output: 100
Explanation: 1 + 1 = 10 in binary (write 0, carry 1). Adding the carry to the remaining 1 again gives 10, so the result is "100" (3 + 1 = 4).
Example 3
Input: num1 = 0, num2 = 0
Output: 0
Explanation: 0 + 0 = 0, so the sum is "0".
Add the two binary numbers exactly like grade-school addition, from the least significant bit to the most: sum the two bits plus any carry, write down sum mod 2, and carry sum divided by 2.
Run checks all cases above. Submit evaluates all test cases.