Leetcode 1477: Find Two Non-overlapping Sub-arrays Each With Target Sum

Pierre-Marie Poitevin
3 min readJun 26, 2020

In this Leetcode problem, we want to find 2 non overlapping subarray with subarray sum target, and we want to find the pair such that sum of the length of both subarrays is minimal:

Problem statement

Solution

Below is the outline of the algorithms I used, which essentially finds all the subarrays and then go through them in order…

--

--