Created
September 9, 2014 00:04
-
-
Save ojenikoh/60d56cf5e34a2211af9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solution($K, $A) { | |
$compliments = array(); | |
array_walk_recursive($A, function($current, $key) use ($K, $A, &$compliments) { | |
foreach ($A as $oKey => $value) { | |
if ($current + $value == $K) { | |
$compliments[] = true; | |
} | |
} | |
}); | |
return count($compliments); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment