1 line Java Solution using BigInteger


  • 1
    X
    import java.math.BigInteger;
    
    public class Solution {
       public String addBinary(String a, String b) {
            return new BigInteger(a, 2).add(new BigInteger(b, 2)).toString(2);
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.