Minimum number of operations to reduce error to zero | Array
Anonymous User
434

Hey!.
Can someone help me out in this problem?

Input = N, A, B
1<= B < = A < = 10^9
1 <=N <= 2* 10^5

Now we are given an array , lets suppose

ARR = [ 6, 5 ,3 ,3 ,1]

We subtract "A" from 6 and "B" from rest of the elements.
So suppose A =4 and B = 1 .
The next state becomes ARR = [ 2 , 4 , 2, 2 ,0] and increment the count.
We need to do this till every element becomes zero and in case any element becomes less than zero, then we assign it zero.
We need to count the minimum number of steps so that we reach all zero state.

Comments (1)