본문 바로가기

코딩테스트

Codility Lesson 09 - MaxDoubleSliceSum(JAVA) https://app.codility.com/programmers/lessons/9-maximum_slice_problem/max_double_slice_sum/ MaxDoubleSliceSum coding task - Learn to Code - Codility Find the maximal sum of any double slice. app.codility.com 문제 - N개의 정수들로 이루어진 배열 A가 주어진다. - (X, Y, Z)는 0 ≤ X < Y < Z < N 범위로 double slice라 지칭한다. - (X, Y, Z) is the total of A[X + 1] + A[X + 2] + ... + A[Y − 1] + A[Y + 1] + A[Y + 2] + ... + A[Z − 1] -.. 더보기
Codility Lesson 09 - MaxSliceSum(JAVA) https://app.codility.com/programmers/lessons/9-maximum_slice_problem/max_slice_sum/ MaxSliceSum coding task - Learn to Code - Codility Find a maximum sum of a compact subsequence of array elements. app.codility.com 문제 - N개의 정수들로 이루어진 A배열이 있다. - (P, Q)는 ) 0 ≤ P ≤ Q < N 범위에서 A[P] + A[P+1] + ... + A[Q]를 의미하는 부분배열의 합이다. - 부분배열의 합중 최대값을 찾아라 - 예시 : A[0] = 3 A[1] = 2 A[2] = -6 A[3] = 4 A[4] = 0 (3, 4) .. 더보기
Codility Lesson 09 - MaxProfit(JAVA) https://app.codility.com/programmers/lessons/9-maximum_slice_problem/max_profit/ MaxProfit coding task - Learn to Code - Codility Given a log of stock prices compute the maximum possible earning. app.codility.com 문제 - N개의 정수들로 이루어진 A배열이 있다. - A배열은 N개의 연속된 기간동안 일일 주가를 포함합니다. - 0 ≤ P ≤ Q < N 범위에서 P는 주식을 매수하고 Q에서 매도 했다고 했을 때, Profit(이익)은 A[Q] - A[P] 의미하며, A[Q] ≥ A[P]일 때는 이익을 반대일 경우에는 A[P] - A[Q]가 손.. 더보기
Codility Lesson 08 - EquiLeader(JAVA) https://app.codility.com/programmers/lessons/8-leader/equi_leader/ EquiLeader coding task - Learn to Code - Codility Find the index S such that the leaders of the sequences A[0], A[1], ..., A[S] and A[S + 1], A[S + 2], ..., A[N - 1] are the same. app.codility.com 문제 - 비어있지 않은 N개의 정수들로 이루어진 배열 A가 주어진다. - leader는 배열의 전체 개수의 반보다 더 많은 원소를 의미한다. - equi leader란 index S( 0 더보기
Codility Lesson 08 - Dominator( JAVA ) https://app.codility.com/programmers/lessons/8-leader/dominator/ Dominator coding task - Learn to Code - Codility Find an index of an array such that its value occurs at more than half of indices in the array. app.codility.com 문제 - N개의 정수들로 이루어진 배열 A가 주어진다. - Dominator란 A배열 개수의 절반 이상의 개수를 가진 값을 의미한다. - 예시 : A[0] = 3 A[1] = 4 A[2] = 3 A[3] = 2 A[4] = 3 A[5] = -1 A[6] = 3 A[7] = 3 3은 Dominator가 된다.. 더보기
Codility Lesson 07 - StoneWall( JAVA ) https://app.codility.com/programmers/lessons/7-stacks_and_queues/stone_wall/ StoneWall coding task - Learn to Code - Codility Cover "Manhattan skyline" using the minimum number of rectangles. app.codility.com 문제 - 벽은 직선으로 N meter만큼 높고, 두께는 일정하지만, 다른 장소에 다른 높이를 가지고 있다. - 벽의 높이 H배열은 N인 양수들로 이루어져 있다. - H[I]는 I ~ I+1( 왼쪽 끝부터 오른쪽 끝 )의 벽의 높이를 뜻한다.( 자세히는 H[0]은 벽의 왼쪽 끝, H[N-1]은 벽의 오른쪽 끝의 높이를 의미한다. ) - 모.. 더보기
Codility Lesson 07 - Nesting( JAVA ) https://app.codility.com/programmers/lessons/7-stacks_and_queues/nesting/ Nesting coding task - Learn to Code - Codility Determine whether a given string of parentheses (single type) is properly nested. app.codility.com 문제 - 하위의 조건에 부합하면 N개의 문자들로 이루어진 S문자열은 적절하게 중첩되었다고 한다. S is empty; S has the form "(U)" where U is a properly nested string; S has the form "VW" where V and W are properly nested .. 더보기
Codility Lesson 07 - Fish( JAVA ) https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/ Fish coding task - Learn to Code - Codility N voracious fish are moving along a river. Calculate how many fish are alive. app.codility.com 문제 - A, B배열은 N개의 정수로 이루어진 비어있지 않은 배열들이다. - A, B배열은 게걸스러운 물고기들을 나타내며, 하류를 따라서 정렬되어 있다. - 물고기의 번호는 0 ~ N-1( 배열 인덱스로 생각 ) - PA[P] : Q가 P를 먹고, 계속 상류방향으로 흐른다. - 물고기들의 모든 흐름 속도는 동일하다. 즉 같은 방향으로 .. 더보기