프로그래머스 [1차] 비밀지도 - java


프로그래머스 [1차] 비밀지도 - java

import java.math.*; class Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; for (int i = 0 ; i < n ; i++) { String temp = ""; for (int j = n-1 ; j >= 0 ; j--) { if (((int)(arr1[i]/Math.pow(2, j))+(int)(arr2[i]/Math.pow(2, j))) > 0) { temp = temp+"#"; } else { temp = temp+" "; } arr1[i]=(int)(arr1[i]%Math.pow(2, j)); arr2[i]=(int)(arr2[i]%Math.pow(2, j)); } answer[i] = temp; } return answer; } } 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.c...



원문링크 : 프로그래머스 [1차] 비밀지도 - java