Codility
My JavaScript solutions to exercises and tests at Codility.
Install / Use
/learn @porsk/CodilityREADME
My JavaScript Codility Solutions
My JavaScript solutions to exercises and tests at Codility.
Lesson 1 - Iterations
- BinaryGap - Find longest sequence of zeros in binary representation of an integer (binaryGap.js) (Codility Report)
Lesson 2 - Arrays
-
CyclicRotation - Rotate an array to the right by a given number of steps (cyclicRotation.js) (Codility Report)
-
OddOccurrencesInArray - Find value that occurs in odd number of elements (oddOccurrencesInArray.js) (Codility Report)
Lesson 3 - Time Complexity
-
FrogJmp - Count minimal number of jumps from position X to Y (frogJmp.js) (Codility Report)
-
PermMissingElem - Find the missing element in a given permutation (permMissingElem.js) (Codility Report)
-
TapeEquilibrium - Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])| (tapeEquilibrium.js) (Codility Report)
Lesson 4 - Counting Elements
-
FrogRiverOne - Find the earliest time when a frog can jump to the other side of a river (frogRiverOne.js) (Codility Report)
-
MaxCounters - Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum (maxCounters.js) (Codility Report)
-
MissingInteger - Find the smallest positive integer that does not occur in a given sequence (missingInteger.js) (Codility Report)
-
PermCheck - Check whether array A is a permutation (permCheck.js) (Codility Report)
Lesson 5 - Prefix Sums
-
CountDiv - Compute number of integers divisible by k in range [a..b] (countDiv.js) (Codility Report)
-
GenomicRangeQuery - Find the minimal nucleotide from a range of sequence DNA (genomicRangeQuery.js) (Codility Report)
-
MinAvgTwoSlice - Find the minimal average of any slice containing at least two elements (minAvgTwoSlice.js) (Codility Report)
-
PassingCars - Count the number of passing cars on the road (passingCars.js) (Codility Report)
Lesson 6 - Sorting
-
Distinct - Compute number of distinct values in an array (distinct.js) (Codility Report)
-
MaxProductOfThree - Maximize A[P] _ A[Q] _ A[R] for any triplet (P, Q, R) (maxProductOfThree.js) (Codility Report)
-
NumberOfDiscIntersections - Compute the number of intersections in a sequence of discs (numberOfDiscIntersections.js) (Codility Report)
-
Triangle - Determine whether a triangle can be built from a given set of edges (triangle.js) (Codility Report)
Lesson 7 - Stacks and Queues
-
Brackets - Determine whether a given string of parentheses (multiple types) is properly nested (brackets.js) (Codility Report)
-
Fish - N voracious fish are moving along a river. Calculate how many fish are alive (fish.js) (Codility Report)
-
Nesting - Determine whether a given string of parentheses (single type) is properly nested (nesting.js) (Codility Report)
-
StoneWall - Cover "Manhattan skyline" using the minimum number of rectangles (stoneWall.js) (Codility Report)
Lesson 8 - Leader
-
Dominator - Find an index of an array such that its value occurs at more than half of indices in the array (dominator.js) (Codility Report 1, Codility Report 2)
-
EquiLeader - Find the index S such that the leaders of the sequences A[0], A[1], ..., A[S] and A[S + 1], A[S + 2], ..., A[N - 1] are the same (equiLeader.js) (Codility Report)
Lesson 9 - Maximum slice problem
-
MaxDoubleSliceSum - Find the maximal sum of any double slice (maxDoubleSliceSum.js) (Codility Report)
-
MaxProfit - Given a log of stock prices compute the maximum possible earning (maxProfit.js) (Codility Report)
-
MaxSliceSum - Find a maximum sum of a compact subsequence of array elements (maxSliceSum.js) (Codility Report)
Lesson 10 - Prime and composite numbers
-
CountFactors - Count factors of given number n (countFactors.js) (Codility Report)
-
Flags - Find the maximum number of flags that can be set on mountain peaks (flags.js) (Codility Report)
-
[MinPerimeterRectangle](https://a
