INNOVACCER Off-Campus OA (2024) |Number of Zero-Filled Subarrays Problem

Question · Posted Jun 2026

Problem Statement Given an integer array nums, return the total number of subarrays that consist entirely of 0s. A subarray is a contiguous non-empty sequence of elements within an array. Example 1 Input nums = [1,3,0,0,2,0,0,4] Output 6 Explanation The zero-filled subarrays are: [0] [0] [0,0] [0] [0] [0,0] Total = 6 Example 2 Input nums = [0,0,0] Output 6 Explanation Possible zero-filled subarrays: [0] [0] [0] [0,0] [0,0] [0,0,0] Total = 6 Example 3 Input nums = [2,10,2019] Output ...

The full answer & interview discussion are available to premium members.

Log in Create a free account