L183 Wood Cut
Given n pieces of wood with lengthL[i]
(integer array). Cut them into small pieces to guarantee you could have equal or more than k pieces with the same length. What is the longest length you can get from the n pieces of wood? Given L & k, return the maximum length of the small pieces.
Notice
You couldn't cut wood into float length.
If you couldn't get >=_k_pieces, return0
.
Example
ForL=[232, 124, 456]
,k=7
, return114
.
O(n log Len), where Len is the longest length of the wood.
Last updated