When two binary strings are added, then the sum returned is also a binary string.
Input : x = "10", y = "01" Output: "11" Input : x = "110", y = "011" Output: "1001" Explanation: 110 + 011 =1001
Here, we need to start adding from the right side and when the sum returned is more than one then store the carry for the next digits.
Let’s see a program in order to get the clear concept of above topic.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.