Grokking Google Coding Interview
Ask Author
Back to course home

0% completed

Solution: Add Binary
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

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:

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible