JS's IT
무지 간단하다 넘어가자 public class Solution { // Complete the alternatingCharacters function below. static int alternatingCharacters(String s) { int count = 0 ; String tmpS = ""; for(int i = 0 ; i < s.length() ; i++) { if(s.substring(i,i+1).equals(tmpS)) { count++; }else { tmpS = s.substring(i,i+1); } } return count; } private static final Scanner scanner = new Scanner(System.in); public static void main..
아나그램.. 이게 뭔지 이제는 알수있다..easy 난이도! 얼른 넘어가자.. public class Solution { // Complete the makeAnagram function below. static int makeAnagram(String a, String b) { int count = 0; HashMap tmpAna = new HashMap(); for(int i = 0 ; i < a.length() ; i++) { if(tmpAna.get(a.substring(i,i+1)) == null ) { tmpAna.put(a.substring(i,i+1), 1); }else { tmpAna.put(a.substring(i,i+1), tmpAna.get(a.substring(i,i+1))+1); ..
최적화의 답이 안떠오르는 문제였다.. 중앙값을 구하는 로직이 핵심알고리즘 같다 하루하루 마다 d개의 숫자를 꺼내어 중앙값을 계산한 다음 처리를 했었는데..이건 속도가 너무 늦다.. 숫자가 어느정도되면 timeout.. 핵심은 지출되는 숫자가 200까지라는건데.. 200개의 배열을 만든 후 각 지출숫자마다 +1씩 해준다..그리고 0부터 for돌면서 각카운팅 숫자 더하면서 d/2번째의 숫자가 중앙값이다..홀수,짝수일때 처리를 다르게 해준 뒤 구해진 중앙값으로 나머지 처리하면 끝.. 처리 후 배열에서 처음 숫자 카운팅 -1, 다음숫자 카운팅+1 public class Solution { static double CalMedian(int[] tmpArr, int d) {int count = 0;double re..