spiralgo / algorithms

We voluntarily solve algorithm problems on this repo.
24 stars 7 forks source link

1231. Divide Chocolate #369

Closed ErdemT09 closed 3 years ago

ErdemT09 commented 3 years ago

Resolves: #217

Algorithm:

I recommend looking at these problems #368, #311 and #122 before moving onto this problem. Like in those problems, we can try to guess our return value. If we pick some "sweetness value" and amount of splits required for it are more than allowed, this means that it's too low and we need to reduce it to split more. If the number of splits is too high or equal, we can try a higher value. We can easily utilize binary searching for this.