Deep_Dev
article thumbnail

 

 


ํ˜•๋ณ€ํ™˜๋งŒ ์ž˜ํ•ด์„œ ํ’€์–ด์ฃผ๋ฉด ๋œ๋‹ค.

 

 

 

์ฒซ๋ฒˆ์งธ ์ฝ”๋“œ

import java.math.BigInteger;
class Solution {
    public String solution(String bin1, String bin2) {
        String answer = "";
        BigInteger a=new BigInteger(bin1,2);
        BigInteger b=new BigInteger(bin2, 2);

        BigInteger sum=a.add(b);

        answer=sum.toString(2);
        return answer;
    }
}

 

 

์กฐ๊ธˆ ๋” ์งง๊ฒŒ ๋ฐ”๊พผ ๋‘๋ฒˆ์งธ ์ฝ”๋“œ

import java.math.BigInteger;
class Solution {
    public String solution(String bin1, String bin2) {
         BigInteger sum=new BigInteger(bin1,2).add(new BigInteger(bin2,2));
        return sum.toString(2);
    }
}