Algorithm/코딜리티
-
(코딜리티) Lesson 11. [Sieve of Eratosthenes] : CountNonDivisible - pythonAlgorithm/코딜리티 2021. 2. 8. 18:50
문제 : app.codility.com/programmers/lessons/11-sieve_of_eratosthenes/count_non_divisible/ CountNonDivisible coding task - Learn to Code - Codility Calculate the number of elements of an array that are not divisors of each element. app.codility.com 문제 내용 N개의 배열 A가 주어질 때, 각 요소마다 배열 A에 있는 원소들로 나누어지지 않는 원소의 갯수를 구하시오. 예를 들어, A = [3, 1, 2, 3, 6] A[0] = 3, 나눠지지 않는 수 : 2, 6 A[1] = 1, 나눠지지 않는 수 : 3, 2, 3, ..
-
(코딜리티) Lesson 10. [Prime and composite numbers] : Peaks - pythonAlgorithm/코딜리티 2021. 2. 5. 19:08
문제 : app.codility.com/programmers/lessons/10-prime_and_composite_numbers/peaks/ Peaks coding task - 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가 주어질 때, A[P − 1] A[P + 1]인 peak를 구하고, peak가 최소한 1개이상 포함된 같은 갯수가 포함된 block을 ..
-
(코딜리티) 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