본문 바로가기

codility

Codility Lesson 12 - CommonPrimeDivisors( JAVA ) https://app.codility.com/programmers/lessons/12-euclidean_algorithm/common_prime_divisors/ CommonPrimeDivisors coding task - Learn to Code - Codility Check whether two numbers have the same prime divisors. app.codility.com 문제 - prime divisor( 이하 pd )란 P라는 정수를 나눌 수 있는 소수를 의미한다. - 예를들어, 20의 pd는 2, 5가 된다. - 우리의 목표는 N, M 2개의 양수들에서 동시에 가진 pd를 구하는 것이다. - 예시 N = 15 and M = 75, the prime divisors are th.. 더보기
Codility Lesson 12 - ChocolatesByNumbers( JAVA ) https://app.codility.com/programmers/lessons/12-euclidean_algorithm/chocolates_by_numbers/ ChocolatesByNumbers coding task - Learn to Code - Codility There are N chocolates in a circle. Count the number of chocolates you will eat. app.codility.com 문제 - 양수 N, M이 주어지며, N은 원에 나열된 초콜렛들을 의미하며 0 ~ N-1까지 넘버링 되어있다. - 0번째 초콜릿 부터 먹으며, 그 다음은 M번 째 초콜릿을 먹는다. - 빈포장지를 만났을 때, 먹는 것을 멈춘다. - 예시 : N=10, M=4일 때, 0, .. 더보기
Codility Lesson 11 - CountSemiprimes(JAVA) https://app.codility.com/programmers/lessons/11-sieve_of_eratosthenes/count_semiprimes/ CountSemiprimes coding task - Learn to Code - Codility Count the semiprime numbers in the given range [a..b] app.codility.com 문제 - prime은 소수를 의미 : 2, 3, 5, 7, 11 ...( 1과 나 자신만이 약수인 수 ) - semiprime은 자연수 중 2개의 소수로 이루어진 수를 의미 : 4, 6, 9, 10, 14 ... - M개의 정수들로 이루어진 P, Q배열이 주어질 때, Query K는 1 더보기
Codility Lesson 11 - CountNonDivisible(JAVA) https://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 문제 - 배열 A가 주어지며, N개의 정수들로 이루어져 있다. - 배열 A의 각 원소들에서 나누어지지 않는 수들의 개수를 구하라. - 예시 : A[0] = 3 A[1] = 1 A[2] = 2 A[3] = 3 A[4] = 6 A[0] = 3, the non-diviso.. 더보기
Codility Lesson 10 - Peaks(JAVA) https://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 문제 - 비어 있지 않은 정수들로 이루어진 A배열이 주어진다. - peak는 주변보다 큰 원소를 의미한다.( 0 A[P + 1] ).. 더보기
Codility Lesson 10 - Flags(JAVA) https://app.codility.com/programmers/lessons/10-prime_and_composite_numbers/flags/ Flags coding task - Learn to Code - Codility Find the maximum number of flags that can be set on mountain peaks. app.codility.com 문제 - 배열 A는 N개의 정수들로 이루어져 있다. - peak란 주변의 값보다 큰 수를 의미한다. inedx P일 때, 0 A[P + 1]인 값을 의미 - 예시 : A[0] = 1 A[1] = 5 A[2] = 3 A[3] = 4 A[4] = 3 A[5] = 4 A[6].. 더보기
Codility Lesson 10 - MinPerimeterRectangle(JAVA) https://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이 주어지며, 사각형의 영역을 의미한다. - 사각형의 영역의 A, B는 각 선을 의미하며 N = A * B를 만족하고, perimeter는 2 * ( A + B )이다. - 같은 영역의 N의 영역에서 perimeter의 최소값을 구하는 것이 목표이다. - 예시.. 더보기
Codility Lesson 10 - CountFactors(JAVA) https://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 문제 - 양수 D는 N의 factor이다. - factor인 것은 N = D * M이 성립될 때를 의미한다. - 예시 : N = 24일 때 factor는 1,2,3,4,6,8,12,24 총 8개를 의미한다. return 8 제한조건 N is an integer within the range [1..2,147,483,647]. N은 1 ~ 2,147,483,647 사.. 더보기