Design Gurus Logo
Add Binary (easy)

Problem Statement

Given two binary strings a and b, return a sum of a and b represented as binary strings.

Examples

  1. 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).
  2. 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).
  3. 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

. . . .

.....

.....

.....

Unlock this and all other premium problems.
No code editor for this lesson
This lesson focuses on concepts and theory