Max Subarray Filled With Zeros

Problem Overview

  • Task: Find the maximum-length subarray that can be made all zeros under limited edits.
  • Input: integer array A, integers X and Y; Output: print the longest zero-filled subarray achievable.
  • Allowed moves: Operation 1 sets a[i] = a[i-1] - 1; Operation 2 sets a[i] = 0; use at most X of Op1 and Y of Op2.
  • Domain: array transformation and constraints, typical coding interview problem.
  • Source: Google interviews; useful as an interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: