Skip to content

#1493 - Longest Subarray of 1's After Deleting One Element

MediumSliding Window
Open on LeetCode

Given a binary array nums, return the size of the longest non-empty subarray containing only 1's in the resulting array after deleting exactly one element. Return 0 if there is no such subarray.

InputOutput
nums = [1,1,0,1,1,1,0,1]5
nums = [0,1,1,1,0,1,1,0,1]5
nums = [1,1,1]2

Released under the MIT License.