Paypal OA Questions
Anonymous User
2420

Q. Given an array arr, you can perform the following operation->
choose any element in the array and repalce that element by any two elements x, y, where x + y == arr[i].
Find minimum number of operations required to sort the array in ascending order.

eg:-
[3,4,3]

answer= 2
answerArray = [1,2,2,2,3]

The constraints were
1 <= A[i] <= 1e9
 1 <=n <= 1e5
Comments (7)