Codility5 [Codility] Caterpillar Method : AbsDistinct https://app.codility.com/programmers/lessons/15-caterpillar_method/abs_distinct/ AbsDistinct coding task - Learn to Code - Codility Compute number of distinct absolute values of sorted array elements. app.codility.com int solution(vector &A) { int sz = A.size(); for(int i=0; i 2021. 7. 16. [Codility] Caterpillar method : CountTriangles https://app.codility.com/programmers/lessons/15-caterpillar_method/count_triangles/ CountTriangles coding task - Learn to Code - Codility Count the number of triangles that can be built from a given set of edges. app.codility.com #include // 1 2 5 8 10 12 int solution(vector &A) { sort(A.begin(),A.end()); int sz = A.size(); int answer = 0; for(int i=0; i 2021. 7. 16. [Codility] Lesson15 - Caterpillar method: MinAbsSumOfTwo https://app.codility.com/programmers/lessons/15-caterpillar_method/min_abs_sum_of_two/ MinAbsSumOfTwo coding task - Learn to Code - Codility Find the minimal absolute value of a sum of two elements. app.codility.com #include int solution(vector &A) { sort(A.begin(),A.end()); int answer = min(abs(A[0] + A[0]), abs(A[A.size()-1]+ A[A.size()-1])); int left = 0; int right = A.size()-1; for(;left 2021. 7. 16. Codility TieRopes C++ https://app.codility.com/c/run/trainingMY49MT-P3G/ Codility Your browser is not supported You should use a supported browser. Read more app.codility.com // you can use includes, for example: // #include // you can write to stdout for debugging purposes, e.g. // cout 2021. 7. 15. 이전 1 2 다음