We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integer.toBinaryString()
String.format("%" + n + "s", str)
package main.java.com.poogle.PG.Q17681; import java.util.Arrays; public class Solution { public static String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; for (int i = 0; i < n; i++) { String str = Integer.toBinaryString(arr1[i] | arr2[i]); //앞에 채워서 최대 5자로 만들기 (문자열 형식 %s에 개수 n을 붙인 상태) str = String.format("%" + n + "s", str); str = str.replaceAll("1", "#"); str = str.replaceAll("0", " "); answer[i] = str; } return answer; } public static void main(String[] args) { System.out.println(Arrays.toString(solution(5, new int[]{1, 20, 28, 18, 11}, new int[]{2, 1, 21, 17, 28}))); } }
The text was updated successfully, but these errors were encountered:
2e98720
suhyunsim
No branches or pull requests
문제
핵심 아이디어
Integer.toBinaryString()
String.format("%" + n + "s", str)
어려운 점, 실수
풀이
The text was updated successfully, but these errors were encountered: