Custom comparator
function comp ( p1 , p2 ) { let a = p1 [ 0 ] , b = p1 [ 1 ] ; let c = p2 [ 0 ] , d = p2 [ 1 ] ; let val1 = 0 , val2 = 0 ; val1 = Math . floor ( a / b ) ; val2 = Math . floor ( c / d ) ; return val1 > val2 ; }