This file contains hidden or 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
| import java.util.ArrayList; | |
| class Solution{ | |
| public int solution(int N){ | |
| ArrayList<Integer> array = new ArrayList<Integer>(); | |
| int count = 0; | |
| int max = 0; | |
| boolean flag = false; | |
This file contains hidden or 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
| import java.util.*; | |
| import java.lang.*; | |
| import java.util.Arrays; | |
| class Solution { | |
| public int solution(int N) { | |
| int N3 = 1; | |
| String bina = Integer.toBinaryString(N); | |
| String pro[] = bina.split("0"); | |
| int[] score = new int[pro.length]; |
This file contains hidden or 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
| import java.util.*; | |
| class Solution { | |
| public int solution(int[] A) { | |
| Map<Integer,Integer> matchMap = new HashMap<Integer,Integer>(); | |
| int unPaired = 0; | |
| for(int i=0;i<A.length;i++){ | |
| int value = matchMap.get(A[i])==null?0:matchMap.get(A[i]); |
This file contains hidden or 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
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.Map.Entry; | |
| class Solution { | |
| public int solution(int[] A) { | |
| int result=0; | |
| HashMap<Integer , Integer> map = new HashMap<Integer , Integer>(); | |
| for(int i=0;i<A.length;i++){ |
This file contains hidden or 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
| function solution(A) { | |
| let solver = { | |
| makeCounterHash: (A) => { | |
| let counterMap = {}; | |
| const ARR_LEN = A.length; | |
| const HALF_IDX = Math.floor(ARR_LEN / 2); | |
| for (let idx = 0; idx <= HALF_IDX; idx++) { | |
| const prenum = A[idx]; | |
| if (counterMap.hasOwnProperty(prenum)) { |
This file contains hidden or 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
| /* | |
| node로 실행 | |
| 풀이 방식 | |
| 시간 복잡도를 O(n)으로 하기 위해 bit연산으로 하여 처리 | |
| 10진수 값을 1과 AND 연산해서 2진수의 역순으로 하나씩 꺼내서 처리 | |
| */ | |
| function solution(N) { | |
| let curNum = N; | |
| let maxZeroCnt = 0; |
This file contains hidden or 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
| class Solution { | |
| public int[] solution(int[] A, int K) { | |
| int[] B = new int[A.length]; | |
| for(int i=0; i<A.length; i++){ | |
| B[(i+K)%A.length] = A[i]; | |
| } | |
| return B; | |
| } |
This file contains hidden or 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
| class Solution { | |
| public int[] solution(int[] A, int K) { | |
| int[] result = new int[A.length]; | |
| int length = 0; | |
| if(K!=0 && A.length!=0){ length = K%A.length; } | |
| for(int i=0;i<A.length;i++){ | |
| if(i+length<A.length){ | |
| result[i+length] = A[i]; | |
| }else{ |
This file contains hidden or 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
| class Solution { | |
| public int solution(int[] A) { | |
| long N = A.length +1; | |
| long totalSum = (N*(N+1))/2; | |
| for(int i=0; i<A.length; i++){ | |
| totalSum -= A[i]; | |
| } | |
| return (int)totalSum; |
This file contains hidden or 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
| function solution(A) { | |
| const sum = (A.length + 1) * (A.length + 1 + 1) / 2; | |
| return A.reduceRight((prev, cur) => prev - cur, sum); | |
| } |
OlderNewer