hayder.net
BAN USER
Comments (3)
Reputation -5
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
-1
of 1 vote
Here's the php solution:
{{{
$string = "co oool ex mple";
$j = count($string) - 1;
for ($i = 0; $i < (count($string)/2); $i++, $j--) {
if !($string[$i] == ' ' || $string[$j] ==' ')
swap($string[$i], $string[$j]);
}
function swap(&$x,&$y) {
$tmp=$x;
$x=$y;
$y=$tmp;
}
-
hayder.net
July 22, 2015 | Flag
Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote
function accumulate (iBinaryOperator $op, array $operand) {
$result = $op->calc($operand[0], $operand[1]);
for ($i = 2; $i < count($operand); $i++) {
$result = $op.calc($result, $operand[$i]);
}
return $result;
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Here's the php solution:
- hayder.net July 22, 2015