l
to 1 and the upper bound r
to the maximum value in ribbons
array.l
is less than or equal to r
:
a. Calculate the mid-point m
as (l + r) / 2
.
b. Calculate the total number of ribbons total
that can be obtained by dividing each ribbon's length by m
.
c. If total
is less than k
, set r
to m - 1
.
d. Otherwise, set l
to m + 1
.r
as the maximum length of the ribbons.