Need help solving this ques, asked in oracle oa

Anonymous User
69
Nov 07, 2025

We are given an array and the task is to make all elements equal by doing the following operations. Cost of each operation is one.
Return the minimum cost of performing the task.
Operations

  1. arr[i] -> arr[i]*2, arr[i] + 1
  2. arr[i] -> arr[i]-1, ceil(arr[i]/2)

I don't have the constraints, but if you have an idea of how to solve it please share the optimized solution that you can think of

Comments (0)