Load Balancer (Greedy )

Didn’t understand the problem properly , can anyone plzz explain

In Input you are given an array : like:
n= 3
Processors_load[] = [0 99 3]

Output :

  • you need to make all the element of the array equal…(in minimum no of steps) means we have to make rebalance if the loads array is not balanced… i.e. ==> (0+99+3)/3 = 34 ==> FINAL load array is : [34,34,34]

  • if sum of all elements is not divisible by n then print -1 ==> means all element of load can not be balanced

  • we need to make the all elements of array equal in Minimum no of steps ==> and in each step we can transfer 1 to “left” or “right” or “left&right”…
    like==>

Now Again watch the video and Now this time i hope you will understand the concept and logic…

I hope this helps