프로그래머스LV1 - 음양 더하기

Kong-al·2022년 10월 13일
0

프로그래머스LV1 - 음양 더하기

[ 답안 ]

class Solution {
	    public int solution(int[] absolutes, boolean[] signs) {
	        int answer = 0;
	        String buho = "";
	        for(int i = 0 ; i < absolutes.length;i++){
	            buho = (signs[i])? "+" : "-" ;
	            answer += Integer.parseInt(buho+absolutes[i]);
	        }
	        return answer;
	    }
	}
profile
웹개발 공부중!(❁´◡`❁)

0개의 댓글