## Solution to Count-Div by codility

16 Apr

Question: https://codility.com/demo/take-sample-test/count_div Question Name: Count-Div or CountDiv It is completely a mathematic question. Not qualified for a 2-star problem.

## Solution to Nailing-Planks by codility

8 Apr

Question: https://codility.com/demo/take-sample-test/nailing_planks Question Name: Nailing Planks or NailingPlanks This question is designed to be solved with binary search method (BUT there is a better solution! It is updated at the end of this post.). And the binary solution is as … Read More »

## Solution to Min-Max-Division by codility

6 Apr

Question: https://codility.com/demo/take-sample-test/min_max_division Question Name: Min-Max-Division or MinMaxDivision Logically, it seems to be similar with the boron2013 (Flags) challenge by Codility. And the following is my Python solution. UPDATE – 2014/09/19: thanks to Martin Kysel. The function signature is changed to: … Read More »

## Solution to Distinct by codility

18 Mar

Question: https://codility.com/demo/take-sample-test/distinct Question Name: Distinct In this question, the expected worst-case time complexity is O(N*log(N)). Thus the designed, or says official, solution would be sort the input and travel them. This solution is practically good. And it is shown as … Read More »

## Solution to helium2013 (Find-Three) by codility

17 Mar

Question: https://codility.com/demo/take-sample-test/find_three Question Name: helium2013 or Find-Three or FindThree For this question, we have two similar but different ways to solve it. The first solution uses the border array algorithm. And the other one is with the Z algorithm for … Read More »

## Solution to Fib-Frog by codility

11 Mar

Question: https://codility.com/demo/take-sample-test/fib_frog Question Name: Fib-Frog or FibFrog To solve this question, we are using the Breadth First Search with pruning. For a game with N intermediate nodes, the count of Fibonacci numbers, to say CF, is proportional to log(N) [Wikipedia]. … Read More »

## Solution to Ladder by codility

9 Mar

Question: https://codility.com/demo/take-sample-test/ladder Question Name: Ladder To solve this question, there are two key points. Firstly, for a given N rungs, the number of different ways of climbing is the (N+1)th element in the Fibonacci numbers. Naturally, we could get the … Read More »

## Solution to nu2011 (Double-Median) by codility

5 Mar

Question: https://codility.com/demo/take-sample-test/double_median Question Name: nu2011 or DoubleMedian For the given queries, we need to find the median in two sorted arrays of different lengths. Then we need to find out the median of the query results. That is, we need … Read More »

## Solution to oxygenium2014 (Count-Bounded-Slices) by codility

27 Feb

Question: https://codility.com/programmers/challenges/oxygenium2014 Question Name: oxygenium2014 or CountBoundedSlices For this question, I was unable to solve it with a golden answer. Instead, I tried to get two silver solutions. Both of them cheated the grading system to have the detected time … Read More »

## Solution to Common-Prime-Divisors by codility

18 Feb

Question: https://codility.com/demo/take-sample-test/common_prime_divisors Question Name: CommonPrimeDivisors