answer
to 0, which will hold the minimum number of operations required.nums[i]
, if it is greater than nums[i + 1]
, calculate the number of elements nums[i]
should be broken into, which is (nums[i] + nums[i + 1] - 1) / nums[i + 1]
.answer
by the number of elements minus one, as this is the number of operations required.nums[i]
to the largest possible value after the operations, which is nums[i] / num_elements
.answer
as the result.