I've tried to solve the problem for some time but still do not know how to do it, must ask for help.
There is given number and array, given number must match with array value (preferable) OR array values.
//EXAMPL 1
$gn=10;
$seq=array();
$seq["A"]=2;
$seq["B"]=2;
$seq["C"]=12;
$seq["D"]=6;
//OUTPUT MUST BE "A","B" and "D" because 2+2+6=$gn and 12!=10
//EXAMPL 2
$gn=10;
$seq=array();
$seq["A"]=1;
$seq["B"]=9;
$seq["C"]=10;
$seq["D"]=3;
//OUTPUT MUST BE "C" because 10=$seq and 1+9 are not preferable.
Does anyone have an idea of how it might be solved?


