- PHP Programmer since 2000:10+ years experience in PHP, MySQL, Javascript, fluent spoken English
- Fri, February 28, 2014Fish Demo Task at Codility.com
- Mon, February 24, 2014Brackets Demo Task at Codility.com
- Domains for Sale:rationalplanet.com is on sale
- Tue, February 25, 2014Nesting Demo Task at Codility.com
- Freelancing:Tools and Techniques Available to Clients Immediately
- WE OFFER ZEND FRAMEWORK Custom Projects Programming
- Fri, February 21, 2014NumberOfDiscIntersections (beta2010) Demo Task at Codility.com
- Free Wordpress Plugins:download plugins from developer's site
- Wed, February 26, 2014StoneWall (sigma2012) Demo Task at Codility.com
LAMP Freelancer » Coding Tips & How-Toes, PHP, Programming & Freelancing, Programming Testing and Exams » Triangle Demo Task at Codility.com
Triangle Demo Task at Codility.com
February 20, 2014 03:05pm | Add a Comment
Lesson 4 – Sorting - Triangle 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: https://codility.com/demo/take-sample-test/triangle
Solution in php:
function solution($A) { $cnt = count($A); if ($cnt < 3){ return 0; } $lcnt = $cnt -2; sort($A, SORT_NUMERIC); for($i = 0; $i < $lcnt; $i++){ if($A[$i] + $A[$i+1] > $A[$i+2]){ return 1; } } return 0; }
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: http://codility-test-questions.blogspot.com/2013/01/my-experience-with-codility-test.html
Related posts:
- MaxProductOfThree Demo Task at Codility.com
- FrogRiverOne Demo Task at Codility.com
- PermCheck Demo Task at Codility.com
- Nesting Demo Task at Codility.com
- NumberOfDiscIntersections (beta2010) Demo Task at Codility.com
Written by Alec
Visit Alec's Website
Follow Alec on Twitter
Filed under: Coding Tips & How-Toes, PHP, Programming & Freelancing, Programming Testing and Exams · Tags: 100/100, Codility.com, PHP, Solutions, Triangle
Support this site: |
Free Wordpress Plugins Hosted
- RP Recreate Slugs
- RP Newsticker Plugin
The Blog
PHP
-
Fish Demo Task at Codility.com
28 Feb 2014
(No Comments)
-
StoneWall (sigma2012) Demo Task at Codility.com
26 Feb 2014
(No Comments)
-
Nesting Demo Task at Codility.com
25 Feb 2014
(No Comments)
-
Brackets Demo Task at Codility.com
24 Feb 2014
(No Comments)
-
NumberOfDiscIntersections (beta2010) Demo Task at Codility.com
21 Feb 2014
(No Comments)
Linux
-
A PHP / MySQL / JavaScript Freelancer and Consultant (Zend, YAF, Lavarel) For Hire
5 Feb 2014
(No Comments)
-
Android? iOS? Blackberry!
28 Jan 2014
(No Comments)
-
Fast installing Sphinx SE on Fedora 14 Server
25 Dec 2012
(No Comments)
-
Fedora 17 Startup Bugs [Solved]
20 Jun 2012
(No Comments)
-
gtkpod not working in Fedora 17 [SOLVED]
19 Jun 2012
(No Comments)
Domains Sale
A group of domains is possibly available for sale.
RATIONALPLANET.COM
RATIONALPLANET.ORG
RATIONALPLANET.NET
RATIONALPLANET.INFO
RATIONALPLANET.BIZ
RATIONALPLANET.MOBI
with
RATIONALHOSTS.COM
RATIONALHOSTS.MOBI
All domains are offered as a single package and cannot be sold separately.
[Please send your offers.]
Switch site
- Switch to our mobile site
Categories
Archives
Articles
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
« Feb | ||||||
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
User Options
- Register
- Entries RSS
- Comments RSS
Log In
Fedora Project – Recent changes
- User:Brickgao
- Ambassadors/APAC/Budget:2015
- Ambassadors/APAC/Budget/Cambodia
Zend Framework
- Zend Server Web API spotlight: Connecting to a Zend Server cluster part 2
- Zend Server Web API Spotlight: New in Zend Server 6.3
- Announcing Zend Server 6.3!
Propel
Tags
Partner Links
Programming by Alec
© 2014 LAMP Freelancer
Recent Comments