denom[1] > denom[2] > ... > denom[n] = 1.
Means that the items in the input should be ordered from largest to smallest.
Take it as a precondition for the algorithm (i.e. this is necessary for the algorithm to work).
Thus, if given 1,7,10
, denom
will be {10,7,1}
and it will pick 1 of demon[1]
.