Given two binary strings, return their sum (also a binary string).
Input: a = "11", b = "1" Output: "100"
We strongly recommend you to minimize your browser and try this yourself first
The idea is to start from last characters of two strings and compute digit sum one by one. If sum becomes more than 1, then store carry for next digits.
Thanks to Gaurav Ahirwar for suggesting above solution. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Add n binary strings
- XOR of two Binary Strings
- Bitwise AND of N binary strings
- Bitwise OR of N binary strings
- XOR two binary strings of unequal lengths
- Generate all binary strings without consecutive 1's
- Generate all binary strings from given pattern
- Count number of binary strings of length N having only 0's and 1's
- Count of non-overlapping sub-strings "101" and "010" in the given binary string
- Count number of binary strings without consecutive 1’s : Set 2
- Number of sub-strings in a given binary string divisible by 2
- Count binary strings with twice zeros in first half
- Count number of binary strings without consecutive 1's
- Number of binary strings such that there is no substring of length ≥ 3
- Number of Binary Strings of length N with K adjacent Set Bits