My JavaScript solutions to exercises and tests at Codility.
- BinaryGap - Find longest sequence of zeros in binary representation of an integer (binaryGap.js) (Codility Report)
-
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)
-
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)
-
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)
-
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)
-
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)
-
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)
-
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)
-
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)
-
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 - Find the minimal perimeter of any rectangle whose area equals N (minPerimeterRectangle.js) (Codility Report)
-
Peaks - 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] > A[P + 1] (peaks.js) (Codility Report)
-
CountNonDivisible - Calculate the number of elements of an array that are not divisors of each element (countNonDivisible.js) (Codility Report)
-
CountSemiprimes - Count the semiprime numbers in the given range [a..b] (countSemiprimes.js) (Codility Report)
-
ChocolatesByNumbers - There are N chocolates in a circle. Count the number of chocolates you will eat (chocolatesByNumbers.js) (Codility Report)
-
CommonPrimeDivisors - Check whether two numbers have the same prime divisors (commonPrimeDivisors.js) (Codility Report)
-
FibFrog - Count the minimum number of jumps required for a frog to get to the other side of a river (fibFrog.js) (Codility Report)
-
Ladder - Count the number of different ways of climbing to the top of a ladder (ladder.js) (Codility Report)
-
MinMaxDivision - Divide array A into K blocks and minimize the largest sum of any block (minMaxDivision.js) (Codility Report)
-
NailingPlanks - Count the minimum number of nails that allow a series of planks to be nailed (nailingPlanks.js) (Codility Report)
-
AbsDistinct - Compute number of distinct absolute values of sorted array elements (absDistinct.js) (Codility Report)
-
CountDistinctSlices - Count the number of distinct slices (containing only unique numbers) (countDistinctSlices.js) (Codility Report)
-
CountTriangles - Count the number of triangles that can be built from a given set of edges (countTriangles.js) (Codility Report)
-
MinAbsSumOfTwo - Find the minimal absolute value of a sum of two elements (minAbsSumOfTwo.js) (Codility Report 1, Codility Report 2)
-
MaxNonoverlappingSegments - Find a maximal set of non-overlapping segments (maxNonoverlappingSegments.js) (Codility Report)
-
TieRopes - Tie adjacent ropes to achieve the maximum number of ropes of length >= K (tieRopes.js) (Codility Report)