Skip to content

作业 #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Create LeetCode_455_12.php
  • Loading branch information
hijkoo authored May 11, 2019
commit 19729d627ecea2b5c96e78104d3e114a2da96ee2
24 changes: 24 additions & 0 deletions Week_04/id_12/LeetCode_455_12.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Solution {

/**
* @param Integer[] $g
* @param Integer[] $s
* @return Integer
*/
function findContentChildren($g, $s) {

asort($g);
asort($s);
$g = array_values($g);
$s = array_values($s);
$child = $cake = 0;
while($child < count($g) && $cake < count($s)){
if($g[$child] <= $s[$cake]){
$child++;
var_dump($child);
}
$cake++;
}
return $child;
}
}