## Solution to sigma2012 (Stone-Wall) by codility

23 Jan

Question: http://codility.com/demo/take-sample-test/stone_wall Question Name: sigma2012 or StoneWall

## Solution to Nesting by codility

22 Jan

Question: http://codility.com/demo/take-sample-test/nesting Question Name: Nesting This question is nearly the same as the previous one, but does not need a stack.

## Solution to Brackets by codility

22 Jan

Question: http://codility.com/demo/take-sample-test/brackets Question Name: Brackets Classic application of stacks.

UPDATE (2016-07-19): Much appreciateÂ Jeffrey’s comment and suggestion: Iâ€™m surprised so few people didnâ€™t do a simple modulo at the start to check whether there is an even number of chars. … Read More »

## Solution to beta2010 (Number-Of-Disc-Intersections) by codility

22 Jan

Question: http://codility.com/demo/take-sample-test/number_of_disc_intersections Question Name: beta2010 or NumberOfDiscIntersections Interesting question. Does geometry matter here? Not much.

UPDATE on 2015/10/16: here is some pseudo-code to help you understand. Firstly, we convert the 2D problem into 1D. Because all the circles’ center … Read More »

## Solution to Triangle by codility

21 Jan

Question: http://codility.com/demo/take-sample-test/triangle Question Name: Triangle Update: we need two parts to prove our solution. On one hand, there is no false triangular. Since the array is sorted, we already know A[index] < = A[index+1] <= A[index+2], and all values are … Read More »

## Solution to Max-Product-Of-Three by codility

21 Jan

Question: http://codility.com/demo/take-sample-test/max_product_of_three Question Name: MaxProductOfThree An small trap: multiplying two negatives makes a positive number.

UPDATE on 03-02-2015: Thanks to @Julian, there is an O(N) solution. We sort the input in the original solution, because we want the two … Read More »

## Solution to Genomic-Range-Query by codility

21 Jan

Question: http://codility.com/demo/take-sample-test/genomic_range_query Question Name: GenomicRangeQuery This is a typical case that uses more space for less time.

## Solution to Passing-Cars by codility

20 Jan

Question: http://codility.com/demo/take-sample-test/passing_cars Question Name: PassingCars

## Solution to Max-Counters by codility

19 Jan

Question: http://codility.com/demo/take-sample-test/max_counters Question Name: MaxCounters A straightforward solution is easy as following. But the expected worst-case time complexity cannot be guaranteed.

We could use lazy-write to improve the performance. When receiving the max_counter command, we record the current-max value, … Read More »

## Solution to Frog-River-One by codility

19 Jan

Question: https://codility.com/demo/take-sample-test/frog_river_one Question Name: FrogRiverOne If coding with C, bitmap is preferred to store which positions are covered.