illuminati

1 min

Add Binary Strings InterviewBit Solution

Problem: Add Binary Strings

Problem Description:

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

Example:

a = "100" -> 4 in decimal
 
b = "11" -> 3 in decimal
 
Return a + b = “111” -> 7 in decimal

Solution Approach:

How will you add two binary numbers on paper? Just try implementing that approach.

Time Complexity:

O(N), where N is the size of input string.

Soultion in C++: