The zero arrayComputer Science Level 4
Given a zero-array (containing only 0's), it is desired to converting it to a certain target array of the same size, and only the following operations are allowed:
Increment: Choose an element from the array and increment it by 1.
Doubling: Double the value of every element on the array
What is the minimum number of operations required to convert a zero-array to the target array shown in the text file?
Details and Assumptions:
For a target array \([2, 2, 3]\) the minimum number of operations is 5.
[0,0,0] -> [1,0,0] -> [1,1,0] -> [1,1,1] -> [2, 2, 2] -> [2, 2, 3]