검색결과 리스트
CountTriangles에 해당되는 글 1건
- 2022.08.20 codility Lesson 풀어보기 6
글
codility Lesson 풀어보기 6
Codiliy Lesson 풀어보기 Day6.
- 아직은 Easy 위주로 진행.
- MVC 스프링 2편 완강 후 코딩테스트 진행
Codility Lesson 10. Prime And Composite Numbers - CountFactors
- 단순 비교를 통해 계산 시 시간복잡도 O(N) 으로 수행되고, 입력값 N이 클 때 타임아웃이 발생해서 퍼포먼스를 만족하지 못한다.
- 비교 및 연산 횟수를 줄일 수 있는 방법을 찾자.
> n의 약수들 중 sqrt(n) 이하인 값들을 구하면 나머지는 n을 해당 값으로 나누어서 구할 수 있다.
https://app.codility.com/demo/results/trainingWK76H5-MVV/
Test results - Codility
A positive integer D is a factor of a positive integer N if there exists an integer M such that N = D * M. For example, 6 is a factor of 24, because M = 4 satisfies the above condition (24 = 6 * 4). Write a function: class Solution { public int solution(in
app.codility.com
Codility Lesson 10. Prime And Composite Numbers - MinPerimeterRectangle
- CountFactors와 비슷하게 진행 (단순 비교 계산시 O(N)으로 타임아웃)
- 일정 값 이상부터는 반복이므로 i*i<=N으로 range 제한
https://app.codility.com/demo/results/trainingGGEHYS-QAX/
Test results - Codility
An integer N is given, representing the area of some rectangle. The area of a rectangle whose sides are of length A and B is A * B, and the perimeter is 2 * (A + B). The goal is to find the minimal perimeter of any rectangle whose area equals N. The sides
app.codility.com
Codility Lesson 11. Euclidean algorithm - ChocolatesByNumbers
- 제목 그대로 유클리드 알고리즘으로 gcd 구현해서 풀이
https://app.codility.com/demo/results/trainingTGFZGV-EMB/
Test results - Codility
Two positive integers N and M are given. Integer N represents the number of chocolates arranged in a circle, numbered from 0 to N − 1. You start to eat the chocolates. After eating a chocolate you leave only a wrapper. You begin with eating chocolate num
app.codility.com
Codility Lesson 12. Caterpillar method - AbsDistinct
- hashMap을 이용해서 abs(key) 값에 true 세팅하여 문제 풀이 (arraylist 사용 시 기존에 값이 존재하는지 여부에 대한 체크가 필요하므로 중복을 고려하지 않는 haspMap을 사용)
https://app.codility.com/demo/results/trainingB37FTT-5GB/
Test results - Codility
A non-empty array A consisting of N numbers is given. The array is sorted in non-decreasing order. The absolute distinct count of this array is the number of distinct absolute values among the elements of the array. For example, consider array A such that:
app.codility.com
Codility Lesson 12. Caterpillar method - CountDistinctSlices
- 이해가 안간다... 머리 살려내..!
- 구글링으로 컨닝
https://app.codility.com/demo/results/training9BE75S-SG5/
Test results - Codility
An integer M and a non-empty array A consisting of N non-negative integers are given. All integers in array A are less than or equal to M. A pair of integers (P, Q), such that 0 ≤ P ≤ Q < N, is called a slice of array A. The slice consists of the eleme
app.codility.com
Codility Lesson 12. Caterpillar method - CountTriangles
- lesson6에서 했던 triangle 을 응용해서 풀이
https://app.codility.com/demo/results/trainingX6ZFPA-77U/
Test results - Codility
An array A consisting of N integers is given. A triplet (P, Q, R) is triangular if it is possible to build a triangle with sides of lengths A[P], A[Q] and A[R]. In other words, triplet (P, Q, R) is triangular if 0 ≤ P < Q < R < N and: A[P] + A[Q] > A[R],
app.codility.com
'Coding Test 준비 > codility' 카테고리의 다른 글
codility Lesson 풀어보기 5 (0) | 2022.08.15 |
---|---|
codility Lesson 풀어보기 4 (0) | 2022.08.06 |
codility Lesson 풀어보기 3 (0) | 2022.06.29 |
codility Lesson 풀어보기 2 (0) | 2022.06.26 |
codility Lesson 풀어보기 (0) | 2022.06.19 |