← All solutions

Add Binary

January 29, 2025 • Go •math, string, bit manipulation, simulation • easy

Go Solution

func addBinary(a string, b string) string {
  num1:= new (big.Int)
  num2:= new (big.Int)
  num1.SetString(a, 2)
  num2.SetString(b, 2)

  sum:= new (big.Int).Add(num1, num2)

  return sum.Text(2)
}
LeetCode Problem Link