( https://app.codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/ ) 문제링크. If문으로 풀다가, 시간복잡도 측면에서도 그렇고, 이렇게 풀면 안될 것같았음. 따라서 다른사람의 풀이를 분석. - XOR연산풀이. public class OddOccurrencesInArray { public static void main(String[] args) { int[] arr = {9, 4, 9, 4, 7, 9, 9, 4, 4}; System.out.println(solution(arr)); } public static int solution(int[] A) { int answer = 0; for(int num : A) { answer..
Rotate an array to the right by a given number of steps. 내 코드 - 정상작동하지만 solution([], 1)에는 error를 발생시킴. - 따라서 배열의 길이가 0일때는 while문에 들어가지 않고 바로 return하는 if조건문을 초반에 삽입해야 함. - 이 코드의 문제는, 배열의 길이만큼 rotate할 때, 0번 한것과 같음에도 불구하고, 5번을 실행하기 때문에 프로그램이 길어진다는 것. class Solution { public int[] solution(int[] A, int K) { if (A.length == 0) { //solution([], 1) 일 경우 대비하기 return A; } while (K > 0) { int sto = A[0]; ..
何をしたか ・(プログラミング)MVC_BORADプロジェクトORACLE DBと連動完了。 ・(プログラミング)fast-campus, restaurant reservation site講座 3回まで見る。 ・(プログラミング)INFLEARN Spring 1回見る。 ・(プログラミング)Codility - Binarygab解ける ・(資格証)基礎情報技術者データベース既出問題解く。 ・(プログラミング)Nomad-coder kakaoclone, 1.2 Status Bar どう思うか ・基本情報処理技術者D-19 もっと集中しましょう!。 次どうするか ・GITHUB整理。MVC、具現した機能記録、実施写真載せる。 ・Codility - Ninarygab Best Answel復習及び分析。
( https://app.codility.com/programmers/lessons/1-iterations/binary_gap/ ) 10진수 N의 2진수를 확인하여, 양끝이 1로시작하고 1로 끝나는 binary gap사이에 있는 0의 갯수 구하기. A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. 내 코드 class Solution { public static int solution(int N) { int result = 0; int biCut = 0; String bi..
- 20201204
- 20200512
- 20200428
- 20200413
- 20200624
- 20200804
- 20200510
- 20200502
- 20200622
- 20200330
- 20200425
- 20200421
- 20200403
- 백준
- 20200427
- 20200415
- likelion
- 20200503
- chapter7
- 20200423
- 20200317
- 20200504
- chapter8
- 20200420
- 20200429
- 20200424
- 생활코딩리눅스
- 20200319
- 20200406
- 20200417
- Total
- Today
- Yesterday