LeetCode – Add Binary (Java)
Given two binary strings, return their sum (also a binary string). For example, a = “11”, b = “1”, the return is “100”. Java Solution Very simple, nothing special. Note how to convert a character to an int. public String addBinary(String a, String b) { if(a==null || a.length()==0) return b; if(b==null || b.length()==0) return a; … Read more