• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 25, 2022 |11.5K Views
Count minimum steps to get the given desired array
  Share   Like
Description
Discussion

Consider an array with n elements and value of all the elements is zero. We can perform following operations on the array. 
 

Incremental operations:Choose 1 element from the array and increment its value by 1.

Doubling operation: Double the values of all the elements of array.

We are given desired array target[] containing n elements. Compute and return the smallest possible number of the operations needed to change the array from all zeros to desired array.

Count minimum steps to get the given desired array: https://www.geeksforgeeks.org/count-minimum-steps-get-given-desired-array/

Read More