about // doc

LeetCode - Add Binary

Click here to go back to LeetCode summary page.

Problem description is here, or as follows:

Given two binary strings, return their sum 
(also a binary string).

For example,
a = "11"
b = "1"
Return "100". 

In Solution 1, the two strings are added bit by bit, and the final result is returned using bin() method in Python which converts an integer to a binary number string. The only thing to note is that the carrier should be taken care of on each addition.

comments powered by Disqus