I was stuck in solving the following interview practice question: I have to write a function:
int triangle(int[] A);
that given a zero-
A 100/100 php solution: http://www.rationalplanet.com/php-related/maxproductofthree-demo-task-at-codility-com.html
function solution($A) { $cnt = count($A); sort($A, SORT_NUMERIC); return max($A[0]*$A[1]*$A[$cnt-1], $A[$cnt-1]*$A[$cnt-2]*$A[$cnt-3]); }