본문 바로가기

🔥 PS(Problem Solving) 🔥/Codility8

[Codility] Lesson 4 Counting Elements : MaxCounters 문제 MaxCounters coding task - Learn to Code - Codility Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum. app.codility.com 결과 Test results - Codility You are given N counters, initially set to 0, and you have two possible operations on them: increase(X) − counter X is increased by 1, max counter − all co.. 2021. 4. 15.
[Codility] Lesson 4 Counting Elements : FrogRiverOne 문제 FrogRiverOne coding task - Learn to Code - Codility Find the earliest time when a frog can jump to the other side of a river. app.codility.com 결과 Test results - Codility A small frog wants to get to the other side of a river. The frog is initially located on one bank of the river (position 0) and wants to get to the opposite bank (position X+1). Leaves fall from a tree onto the surface of the.. 2021. 4. 7.
[Codility] Lesson 3 Time Complexity : TapeEquilibrium 문제 TapeEquilibrium coding task - Learn to Code - Codility Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|. app.codility.com 결과 누적합 Test results - Codility A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A.. 2021. 4. 6.
[Codility] Lesson 3 Time Complexity : PermMissingElem 문제 PermMissingElem coding task - Learn to Code - Codility Find the missing element in a given permutation. app.codility.com 결과 합 이용 Test results - Codility An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing. Your goal is to find that missing element. Write a function: class Solution { publ.. 2021. 4. 6.
[Codility] Lesson 3 Time Complexity : FrogJmp 문제 FrogJmp coding task - Learn to Code - Codility Count minimal number of jumps from position X to Y. app.codility.com 결과 Test results - Codility A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D. Count the minimal number of jumps that the .. 2021. 4. 5.
[Codility] Lesson 2 Arrays : OddOccurrencesInArray 문제 OddOccurrencesInArray coding task - Learn to Code - Codility Find value that occurs in odd number of elements. app.codility.com 결과 Test results - Codility A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. For.. 2021. 4. 5.
[Codility] Lesson 2 Arrays : CyclicRotation 문제 CyclicRotation coding task - Learn to Code - Codility Rotate an array to the right by a given number of steps. app.codility.com 결과 int[] Test results - Codility An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9,.. 2021. 4. 2.
[Codility] Lessons 1 Iterations : BinaryGap 문제 BinaryGap coding task - Learn to Code - Codility Find longest sequence of zeros in binary representation of an integer. app.codility.com 결과 Test results - Codility A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a bi.. 2021. 4. 2.