티스토리 뷰
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package KAKAO; | |
public class map { | |
public static void main(String[] args) { | |
int n = 5; | |
int[] arr1 = {9, 20, 28, 18, 11}; | |
int[] arr2 = {30, 1, 21, 17, 28}; | |
System.out.println(solution(n, arr1, arr2)); | |
} | |
public static String[] solution(int n, int[] arr1, int[] arr2) { | |
String[] result = new String[n]; | |
for (int i = 0; i < n; i++) { | |
String temp = Integer.toBinaryString(arr1[i] | arr2[i]); | |
temp = String.format("%" + n + "s", temp); | |
temp=temp.replaceAll("1", "#"); | |
temp=temp.replaceAll("0", " "); | |
result[i] = temp; | |
System.out.println(result[i]); | |
} | |
return result; | |
} | |
} | |

반응형
'알고리즘 > 프로그래머스' 카테고리의 다른 글
2020 카카오 문자열 압축 (0) | 2021.04.20 |
---|---|
2018 카카오 캐시 (0) | 2021.04.20 |
2019 카카오 후보키 (0) | 2021.04.20 |
2021 카카오 광고 삽입 (0) | 2021.04.20 |
2019 카카오 오픈채팅 (0) | 2021.04.20 |
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- spring-cloud
- 자격증
- CS
- 수학
- security
- JPA
- 릿코드
- 프로그래머스
- Algorithm
- 스프링부트
- docker
- nginx
- Matlab
- C언어
- kakao
- 백준
- ajax
- java
- 면접
- 알고리즘
- 디자인패턴
- springboot
- 스프링
- OOP
- interview
- 자바
- Spring
- 그래프
- Solid
- 매트랩
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함