![]() |
"踏上LeetCode解題之路,順手紀錄一下PHP練功的過程囉。這是第二十篇~~" |
思考過程
待補上
結果✅
class Solution { /** * @param Integer[] $nums * @return Integer */ function missingNumber($nums) { $count = count($nums); $i = 0; while($i <= $count) { $key = array_search($i, $nums); if ($key == ''){ return $i; } $i++; } } }
參考資料