https://school.programmers.co.kr/learn/courses/30/lessons/17681
class Solution {
public String[] solution(int n, int[] arr1, int[] arr2) {
String[] answer = new String[n];
for(int i=0; i<n; i++){
// or์ฐ์ฐ -> ํ๋๋ผ๋ ๋ฒฝ('1')์ธ ๊ฒฝ์ฐ 1์ ์ฅ
answer[i]=Integer.toBinaryString(arr1[i] | arr2[i]);
answer[i]=answer[i].replace('0',' ');
answer[i]=answer[i].replace('1','#');
// ์๋ฆฟ์๋ง์ถ๊ธฐ (ex: ์ด์ง์ ๋ณํ์ 1์ 00001์ด ์๋ 1์ด๋ค. )
while(answer[i].length()<n){
answer[i]=' '+answer[i];
}
}
return answer;
}
}
'๐ ์ฝ๋ฉํ ์คํธ > ๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ์น์์ด (2) (0) | 2023.03.15 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ๋๋ง์ ์ํธ (0) | 2023.03.14 |
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ํ๋ฒ๊ฑฐ ๋ง๋ค๊ธฐ ( *Stack ) (0) | 2023.03.09 |
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ๊ธฐ์ฌ๋จ์์ ๋ฌด๊ธฐ (*์ฝ์) (0) | 2023.03.08 |
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ๋ช ์์ ์ ๋น(1) ( *์ฐ์ ์์ ํ ) (0) | 2023.03.06 |