Add Binary

Easy

Company Tags

You are given two binary strings a and b, return their sum as a binary string.

Example 1:

Input: a = "101", b = "10"

Output: "111"

Example 2:

Input: a = "10010", b = "111"

Output: "11001"

Constraints:

  • 1 <= a.length, b.length <= 10,000
  • a and b consist only of '0' or '1' characters.
  • Each string does not contain leading zeros except for the zero itself.


Company Tags

Please upgrade to NeetCode Pro to view company tags.

a =

b =