Web Projects Outsourcing

MinPerimeterRectangle Demo Task at Codility.com

Excellent solutions for codility demo tasks

Codility.com Tests 100/100 Solutions

Lesson 8 –  Prime and composite numbers – MinPerimeterRectangle demo task solution code written in php. Gives 100/100 score at the time of publishing.

The description of the problem is copyrighted, so please see the following link for it: //codility.com/demo/take-sample-test/min_perimeter_rectangle

Solution in php:

function solution($N) {
    $minPer = null;
    for($i = 1; $i * $i <= $N; $i++){
        if($N % $i == 0){
                $minPer = 2 * ($N / $i + $i);
            $minPer = min($minPer, 2 * ($N / $i + $i));
    return $minPer;

Given “AS IS”, can be ported from other languages from solutions found on the internet, please use with care.

Please note: we think that codility.com does not give a correct assessment of your real-world programming skills. For instance, reading the below would bring more understanding why: //x20x.co.uk/2014/02/why-i-refuse-to-use-codility-and-so-should-you/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.