Комментарии:
How to fix .... Undefined offset 0,1...
Ответить// this might help simplify it
$array = [1, 2, 3, 4, 5, 6, 1, 2, 5, 8, 3, 4, 5, 5, 5, 5, 9];
$arrayCountValues = array_count_values($array);
asort($arrayCountValues);
echo array_key_first($arrayCountValues);
Please make some more videos on technical interview questions
Ответитьno need for any foreach loop at all ... just use `$itemCountArray = array_count_values($numArray);` and then sort `$itemCountArray`. `array_count_values()` is built in PHP function ...
ОтветитьCan you please create video of hackerrank To explain and solve problem in php
Ответить$input = [1,0,2,3,4,5,5,4,5,3,2,1,5,1,1,1,1,4,3];
$elementCount = array_count_values($input);
sort($elementCount);
$minCountElement = array_key_first($elementCount);
var_dump($minCountElement);
array_key_first will do it right after the asort function. Nice job btw
ОтветитьGood question with explanation
Ответить👍👍👍
ОтветитьGreat video. Although it would have been easier if you had just used array_count_values in your logic. No need to reinvent the wheel.
ОтветитьNew video
Ответить