Given n binary strings, return their sum (also a binary string).
Input: arr = ["11", "1"] Output: "100" Input : arr = ["1", "10", "11"] Output : "110"
- Initialize the ‘result’ as an empty string
- Traverse the input from i = 0 to n-1
- For each i, add arr[i] to the ‘result’. How to add ‘result’ and arr[i]? Start from the last characters of the two strings and compute digit sum one by one. If sum becomes more than 1, then store carry for next digits. Make this sum as the ‘result’
- The value of ‘result’ after traversing the entire input is the final answer
- Bitwise AND of N binary strings
- Bitwise OR of N binary strings
- Program to add two binary strings
- Generate all binary strings without consecutive 1's
- Generate all the binary strings of N bits
- Generate all binary strings from given pattern
- Count of non-overlapping sub-strings "101" and "010" in the given binary string
- Count binary strings with twice zeros in first half
- Count number of binary strings without consecutive 1's
- Given two binary strings perform operation until B > 0 and print the result
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Number of Binary Strings of length N with K adjacent Set Bits
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Count binary strings with k times appearing adjacent two set bits
- Count number of binary strings such that there is no substring of length greater than or equal to 3 with all 1's
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.