Problem 3728 · Medium

Stable Subarrays With Equal Boundary and Interior Sum

Use prefix sums and a hash map so each right end finds the left ends whose endpoint and interior sum both match.

Open the interactive visualisation