[Go] Array and string - Add binary
Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" Constraints: 1 = 0 { switch { case carry == 1: if aa[alen] == "0" && bb[blen] == "0" { ans = append([]string{"1"}, ans...) carry = 0 alen-- blen-- } else if aa[alen] == "1" && bb[blen] == "0" || aa[alen] == "0" && bb[ble..
Go/Leet Code
2022. 4. 3. 20:15