1891. Cutting Ribbons

time: O(nlogn), getCount use O(n), inside binary search, so O(nlogn)

space: O(1)

range: 1~ max ribbons len,

optimized, use Math.min(end, sum/k)

notice edge case : sum < k

因為如果 end 符合, 優先回 end , 因為答案要長一點的

Last updated

Was this helpful?