Back to course home
0% completed
Vote For New Content
Add Binary (easy)
Problem Statement
Given two binary strings a
and b
, return a sum of a
and b
represented as binary strings.
Examples
-
Example 1:
- Input: a = "10110", b = "10101"
- Expected Output: "101011"
- Justification: The binary sum of "10110" (22 in decimal) and "10101" (21 in decimal) is "101011" (43 in decimal).
-
Example 2:
- Input: a = "111", b = "1"
- Expected Output: "1000"
- Justification: The binary sum of "111" (7 in decimal) and "1" (1 in decimal) is "1000" (8 in decimal).
-
Example 3:
- Input: a = "0", b = "0"
- Expected Output: "0"
- Justification: The binary sum of "0" and "0" remains "0".
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page
Problem Statement
Examples
Try it yourself