Binary Subarrays With Sum

Medium · Hashing · about 15 minutes

Asked at Google, Microsoft, NVIDIA, Bloomberg, Amazon, Hudson River Trading, Waymo, Optiver, Epic Games, Anduril, xAI, Mistral AI, Jump Trading.

nums is made of 0s and 1s. Count the non-empty contiguous slices that contain exactly goal ones.

Related guides