Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5];
function findIt(array $seq)
{
$arr = array_count_values($seq);
$el = [];
foreach($arr as $a){
if($a >= 1 && $a % 2){
$el = $a;
}
}
$res = array_keys(array_filter($arr, $el));
print_r($res);
return $res;
}
print_r(findIt($seq));