Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
atheist98053ySounds fun. Calculate lengths of sticks once all cuts are made. Recursively merge adjacent segments that give the shortest segment length when merged. Reverse merge order for result.
-
atheist98053yif you have cuts at length 3, 7 and 8, stick length 10:
if cuts done 7,3,8, costs 10+7+3,
if cut done 3,7,8 cost is 10+7+3
Cuts done 3,8,7 cost is 10+7+5
Cuts done 8,7,3 cost is 10+8+7
Cuts done 8,3,7 cost is 10+8+4
Other permutations aren't interesting
Related Rants
When the Problem setter doesn't want to type a lot...
rant
leetcode