stuck on the problem building fences

Revision en1, by hiddentesla, 2016-09-14 14:43:11

hello!, about a while back, i came across a problem called "building fences", link:, back then i cant solve it, and yesterday i remembered about that problem and attemp to solve it again, but still, i could not solve it. im thinking about binary searching the length of the log, to find the the highest log length (ill denote it L) that we can make, but then i noticed that if the log length is divisible by L, the number of cuts to get the logs to size L is log_length/L -1, and if its not divisible by L, the number is log_length/L. so while that binary search may return the largest L, it may not be the minimum cut, right?

so can anyone give me some hints on this problem? could this just be a simple problem and i have ben looking at it the wrong way?

Tags binary search


  Rev. Lang. By When Δ Comment
en1 English hiddentesla 2016-09-14 14:43:11 835 Initial revision (published)