Expedia | Phone | Minimum number of operations to sort array
Anonymous User
1593

Location: U.S.

Given an array of positive numbers, you can replace any number with two numbers that sum to it. Return the minimum number of operations to sort the array.
I wasn't able to come up with the solution ... what am I supposed to do here?

Example:
Input: [3, 4, 3]
Output: 2 (since [3,4,3] -> [3, 2, 2, 3] -> [1, 2, 2, 2, 3])

Comments (4)