본문 바로가기

코딩테스트

Codility Lesson 05 - PassingCars( JAVA ) https://app.codility.com/programmers/lessons/5-prefix_sums/passing_cars/ PassingCars coding task - Learn to Code - Codility Count the number of passing cars on the road. app.codility.com 문제 - 비어있지 않은 A배열은 N개의 정수들로 이루어져 있다. - 연속적인 A배열의 원소들은 길 위의 연속적인 차들을 나타낸다. - A는 0과 1로만 이루어져 있고, 0은 동쪽( east )로 여행하는 차를 나타내며, 1은 서쪽( west )로 여행하는 차를 나타낸다. - 차들의 짝을 ( P, Q ), 조건 : 0 (0, 1), (0, 3), (0, 4) 2 : index기.. 더보기
Codility Lesson 04 - MissingInteger( JAVA ) https://app.codility.com/programmers/lessons/4-counting_elements/missing_integer/ MissingInteger coding task - Learn to Code - Codility Find the smallest positive integer that does not occur in a given sequence. app.codility.com 문제 - A는 N개의 정수들로 이루어진 배열이다. - A 배열에는 없는 0보다큰 최소의 양수값을 반환합니다. - 예시 A = [ 1, 3, 6, 4, 1, 2 ] -> return 5 A = [ 1, 2, 3 ] -> return 4 A = [ -1, -3 ] -> return 1 제한조건 N is a.. 더보기
Codility Lesson 04 - MaxCounters( JAVA ) https://app.codility.com/programmers/lessons/4-counting_elements/max_counters/ MaxCounters coding task - Learn to Code - Codility Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum. app.codility.com 문제 - N counters는 초기에 모두 0으로 초기화되어 있는 구조이다. - 2가지의 연산방법이 있다. - increase(X) : 해당하는 X 순번의 counters의 수를 +1한다. .. 더보기
Codility Lesson 04 - PermCheck( JAVA ) https://app.codility.com/programmers/lessons/4-counting_elements/perm_check/ PermCheck coding task - Learn to Code - Codility Check whether array A is a permutation. app.codility.com 문제 - 배열 A는 비어있지 않은 배열이다. - 배열 A는 순열이다.( 1 ~ N까지 중복없이 하나씩 존재 ) - 예시 : A = [4, 1, 3, 2]는 순열, A = [4, 1, 3]은 2가 빠졌기에 순열이 아니다. - A배열이 순열인지 아닌지를 판단하는 문제 제한조건 N is an integer within the range [1..100,000]; each element of.. 더보기
Codility Lesson 04 - FrogRiverOne( JAVA ) https://app.codility.com/programmers/lessons/4-counting_elements/frog_river_one/ FrogRiverOne coding task - Learn to Code - Codility Find the earliest time when a frog can jump to the other side of a river. app.codility.com 문제 - 작은 개구리가 0위치에서 시작해서 X+1위치까지 건너가고 싶어한다. - A 배열은 각 위치에 나뭇잎이 떨어지는 시간( second )를 나타낸다. - 작은 개구리는 건너가고자 하는 모든 위치에 나뭇잎이 존재해야지만 건너갈 수 있다. - 목표 위치까지 가장 빠르게 건널 수 있는 시간을 구해라. 제한조건 .. 더보기
Codility Lesson 03 - TapeEquilibrium( JAVA ) https://app.codility.com/programmers/lessons/3-time_complexity/tape_equilibrium/ TapeEquilibrium coding task - Learn to Code - Codility Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|. app.codility.com 문제 - 배열 A는 비어있지 않고, N개의 정수( Integer )로 되어있다.( 배열 A는 테이프 위의 수들이다 ) - 0 < P < N의 P는 테이프를 비어있지 않은 2개의 배열로 분할한다.( A[0] ~ A[P-1] / A[P] ~ A[N-1] ) - P의 범위 안에서 분할된 첫번째, 두번째 부분배열의 합의 차.. 더보기
Codility Lesson 03 - PermMissingElem( JAVA ) https://app.codility.com/programmers/lessons/3-time_complexity/perm_missing_elem/ PermMissingElem coding task - Learn to Code - Codility Find the missing element in a given permutation. app.codility.com 문제 - A 배열에는 모두 다른 정수가 주어진다. ( 범위 : 1 ~ N+1 ) - 놓친( missing ) 원소를 찾는 것이 목표 - 예시 : [ 2, 3, 1, 5 ] / 답안 : 4 제한조건 N is an integer within the range [0..100,000]; the elements of A are all distinct; ea.. 더보기