Medium · Binary Search
Maximum Length of Ribbon Cut
Given an array ribbons of positive integer lengths and an integer k, return the maximum integer length L such that cutting the ribbons into pieces of length L (leftovers are discarded) yields at least k pieces, or 0 if no positive length does.
Examples
Example 1
ribbons [5,7,9], k=4Output: L = 4
Example 2
ribbons [9,7,5], k=3Output: L = 5
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.