전체보기
-
(코딜리티) Lesson 10. [Prime and composite numbers] : MinPerimeterRectangle - pythonAlgorithm/코딜리티 2021. 2. 4. 18:41
문제 : app.codility.com/programmers/lessons/10-prime_and_composite_numbers/min_perimeter_rectangle/ MinPerimeterRectangle coding task - Learn to Code - Codility Find the minimal perimeter of any rectangle whose area equals N. app.codility.com 문제 내용 양수 N이 주어질 때, N을 A*B로 나타낸 경우에 2*(A+B)가 최소인 값을 return하시오. 예를 들어, N = 30인 경우 (A,B) : (1, 30) = 62 (A,B) : (2, 15) = 34 (A,B) : (3, 10) = 26 (A,B) : (5, 6)..
-
(코딜리티) Lesson 10. [Prime and composite numbers] : Flags - pythonAlgorithm/코딜리티 2021. 2. 3. 18:04
문제 : app.codility.com/programmers/lessons/10-prime_and_composite_numbers/ 10. Prime and composite numbers lesson - Learn to Code - Codility Divide an array into the maximum number of same-sized blocks, each of which should contain an index P such that A[P - 1] A[P + 1]. app.codility.com 문제 내용 비어있지 않은 N개의 배열 A가 주어질 때, 0 3 2 X P X P X => 5 3 X P XX P XX P X => 9 4 X P XXX P XXX P XXX P X ..
-
(코딜리티) Lesson 10. [Prime and composite numbers] : CountFactors - pythonAlgorithm/코딜리티 2021. 1. 30. 21:06
문제 : app.codility.com/programmers/lessons/10-prime_and_composite_numbers/count_factors/ CountFactors coding task - Learn to Code - Codility Count factors of given number n. app.codility.com 문제 내용 양수인 숫자 N이 주어질 때, N의 약수 갯수를 구하시오. 제한 사항 N은 1~2,147,483,647 코드 def solution(N): count = 0 i = 0 while True: i +=1 n = N%i m = N//i if i > m: return count if n == 0: if i == m: count += 1 return count else..
-
(코딜리티) Lesson 9. [Maximum slice problem] : maxSliceSum - pythonAlgorithm/코딜리티 2021. 1. 29. 18:56
문제 : app.codility.com/programmers/lessons/9-maximum_slice_problem/ 9. Maximum slice problem lesson - Learn to Code - Codility Given a log of stock prices compute the maximum possible earning. app.codility.com 문제 내용 비어 있지 않은 N개의 배열 A가 주어질 때, 0
-
(코딜리티) Lesson 9. [Maximum slice problem] : max_profit - pythonAlgorithm/코딜리티 2021. 1. 29. 18:53
문제 : 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가 주어질 때, 0
-
(코딜리티) Lesson 9. [Maximum slice problem] : MaxDoubleSliceSum - pythonAlgorithm/코딜리티 2021. 1. 29. 18:42
문제 : 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가 주어질 때, 0
-
(코딜리티) Lesson 8. [Leader] : EquiLeader - pythonAlgorithm/코딜리티 2021. 1. 28. 18:47
문제 : 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가 주어질 때, S는 0 left_leader_count: left_leader = a left_leader_count = left_dict[a] if left_leader_count > left_len/..
-
(코딜리티) Lesson 8. [Leader] : Dominator - pythonAlgorithm/코딜리티 2021. 1. 28. 18:33
문제 : 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가 주어질 때, 배열 A의 지배자를 찾아내시오. 지배자는 각 배열 요소의 값이 배열의 반 넘게 발생하면, 이 값은 배열 A의 지배자라고 할 수 있다. 예를 들어, A = [3, 4, 3, 2, 3, -1 ,3 ,3]일 때, 3이 총 5번으로 8개중에 반 넘게 등장하므로, 지배자는 3이고..