Given two binary strings, return their sum (also a binary string).

The input strings are both non-empty and contains only characters 1 or 0.

Input: a = “11”, b = “1”

Output: “100”

Input: a = “1010”, b = “1011”

Output: “10101”

```public class Program {

public static void Main(string[] args) {
var a = "1010";
var b = "1011";

Console.WriteLine(res);

}

private static string AddBinary(string a, string b) {
//找出最长的加1，留1位进位
var max = Math.Max(a.Length, b.Length) + 1;
//按总长度补位，以便统一处理，否则要考虑边界
//定义list存中间计算结果
var list = new List<int>();
//进位标志
var carryFlag = false;
for(int i = max - 1; i >= 0; i--) {
+ int.Parse(b2[i].ToString());
//计算当前位的值，如果之前进位标志为真，则额外+1
//大于等于2时，此时仍然需要进位，带入下一次循环
//存入中间计算结果
}
//定义结果
var res = string.Empty;
//反转，list是按逆序从低位到高位的
list.Reverse();
//遍历输出到res
list.ForEach(r => { res += r.ToString(); });
//取消最高位0
res = res.TrimStart('0');
//如果空了，返回0
if(res.Length == 0) res = "0";
//返回结果
return res;
}

}```

`10101`