Maximum Zeroes via Zero-Free Prefix Decrements

Asked at Amazon · Coding Questions · Difficulty: Medium

Given an array `arr` of positive integers, you may repeatedly pick a prefix that contains no zero and decrement every element of it by 1. Return the maximum number of zeroes the array can contain after any number of such operations.

Loading the problem…