Algorithm · Google · Hard
Given an integer array, determine the longest contiguous portion that can consist entirely of zeros after applying the following operations within their respective limits. Operation 1: For an index i where i >= 0 and i < size of array, assign a[i] = a[i-1] - 1. Operation 2: Assign a[i] = 0. You may use Operation 1 no more than X times and Operation 2 no more than Y times. Input: Array A, int X, int Y. Output: Print the maximum length of a contiguous subarray that can be made…
Checking your access…