Add Binary Numbers
Given two strings a and b that represent binary numbers, add them and return their sum, also as a string.
The input strings are guaranteed to be non-empty and contain only 1s and 0s.
Constraints
n ≤ 100,000wherenis the length ofam ≤ 100,000wheremis the length ofb
https://binarysearch.com/problems/Add-Binary-Numbers
Examples
Example 1
Input
- a =
1 - b =
1
Output
- answer =
10
Example 2
Input
- a =
111 - b =
1
Output
- answer =
1000
Leave a comment