JS's IT
생각보다..어렵진 않았다..숫자 비교후 1,0,-1 반환하고.. 0일때 글자 비교해서 1,0,-1 반환 해주면 된다.. 금방이네.. class Player {String name;int score; Player(String name, int score) {this.name = name;this.score = score;}} class Checker implements Comparator { // complete this methodpublic int compare(Player a, Player b) { int result = 0;if(a.score b.score) {result = -1;}else {return a.name.toS..
easy라 그런지 쉽게 패스 오름차순 정렬하면서 더하기.. 그러다 예산 넘으면 스탑 public class Solution { // Complete the maximumToys function below. static int maximumToys(int[] prices, int k) { int sum = 0; int count = 0; for(int i = 0 ; i prices[j]) { int tmp = prices[i]; prices[i] = prices[j]; prices[j] = tmp; } } if(sum+prices[i] > k) { ..
이런 문제는 어떻게 내는걸까.. 이해하기 힘든 문제다..한쌍의 숫자배열을 여러개 받아 앞의 숫자는 처리구분 숫자 뒤의 숫자는 입력숫자 Operation Array Output(1,1) [1](2,2) [1](3,2) 0(1,1) [1,1](1,1) [1,1,1](2,1) [1,1](3,2) 1 1이면 입력, 2면 제거, 3이면 주파수?가 정확히 일치하는 정수가 있는지 확인해서 맞으면 1 아니면 0아직도 정확한 이 주파수?라는걸 모르겠다.. 일단 입력된 숫자와 갯수를 hashmap에 묶어서 넣어주고3일때의 숫자가 넣어준 숫자의 갯수와 일치되는것이 있을때 1을 리턴해줬다. 원래는 freqQuery 만 수정하면 무조건 timeout 에러가난다.. (도대체 얼마나 더 줄여야되는건지....)그래서 메인함수 출력부..