Trains the technique from
LeetCode 2395Find Subarrays With Equal SumThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A conveyor holds readings nums.
Consider the pairs of neighbouring readings: the pair at position i is nums[i] together with nums[i + 1]. Two such pairs are different when they start at different positions, even if they hold the same readings.
Return true when two different neighbouring pairs have the same total.
Example 1
The neighbouring pairs total 23, 14, 23, 24 and 23, so the pair starting at position 0 and the one starting at position 2 match.
Example 2
The totals are 30, 50, 70 and 90, all different.
Example 3
Both pairs hold the same readings and so total the same, and they start at different positions, which is what makes them different pairs.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def find_subarrays(nums: list[int]) -> bool:public boolean findSubarrays(int[] nums)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.