https://programmers.co.kr/learn/courses/30/lessons/68644 import java.util.*; class Solution { public int[] solution(int[] numbers) { HashSet hashSet = new HashSet(); for(int i = 0; i < numbers.length ; i++){ for(int j = i+1; j < numbers.length ; j++){ hashSet.add(numbers[i] + numbers[j]); } } Object [] objArr = hashSet.toArray(); int [] answer = new int[hashSet.size()]; for(int i = 0; i< objArr...
https://programmers.co.kr/learn/courses/30/lessons/12911 int answer = 0; String nStr = Integer.toBinaryString(n); int oneValue = nStr.replace("0", "").length(); boolean flag = true; while(flag){ n++; String nStrTemp = Integer.toBinaryString(n); if(nStrTemp.replace("0", "").length() == oneValue){ flag = false; answer = n; } } 핵심은 toBinaryString을 알고 있느냐(몰라서 찾아봄...) 두번째로는 1의 갯수와 일치하는 부분인거 같다. repla..
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class main { public static void main(String[] args) { String new_id = "...!@BaT#*..y.abcdefghijklm"; System.out.println(new_id.substring(0,3)); //1 new_id = new_id.toLowerCase(); System.out.println("1 " + new_id); //2 String [] chr = new_id.split("");..