Hey!, I recently gave google Online Assesment, and i wanted to know how to solve this question, it was asked in my google OA
Question: given an array of integers, you can perform 2 operations on them
Operation 1:
You can make a[i]=a[i]-1 (i>=0 and i<size of array)
Operation 2:
You can make a[i]=0
INPUT:
Array A, int X, int Y
OUTPUT:
You have to print the max subarray filled with zeros that can be made by performing Operation 1 at the most X times and Operation 2 at the most Y times
Example:
input : [4,3,0,1] , X=2,Y=1
Output: 3
Explaination:
Step1 : [4,0,0,1] X=2,Y=0
Step2: [4,0,0,0] X=1,Y=0
Therefore the output is 3