```
def addBinary(self, a, b):
i = len(a)-1
j = len(b)-1
ret = ''
c = 0
while i >= 0 or j >= 0 or c == 1:
sum = (i >= 0 and a[i] == '1') + (j >= 0 and b[j] == '1') + c
ret = str(sum % 2) + ret
c = sum / 2
i -= 1
j -= 1
return ret
```