Your question is Binary String Addition. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Hudson River Trading market-data component represents certain compact counters as binary strings. Given two non-negative binary strings, return their sum as a binary string without converting either input to a built-in integer type.
Process the strings from right to left, maintaining a carry. The inputs contain no leading zeroes unless the value is exactly "0".
Implement add_binary(a, b):
a and b, each containing only the characters 0 and 1.a + b, with no leading zeroes unless the result is "0".def add_binary(a, b):