Sign in

I have found a very interesting way to add binary numbers. If we want to add binary numbers we will be needing three variables namely

1. Digit of first binary number
2. Digit of second binary number
3. Carry which we will get by adding the variables from 1 and 2.

WHAT WE WILL DO:

1. Loop through the binary number strings and add the digits at a specific index.

2. Changing the carry whenever required

3. Return the binary after looping through all the digits of the binary number

Explanation for STEP 1:

We take an index for both strings and start at the right most index.
Suppose…

Kshitiz

I am a Front-End Developer who loves to travel and solving algorithms

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store