CodingReported in a candidate post, Jun 2023
Return all subarrays with a given sum in better than O(n^2)
Filed under ixigo
The question
Given an array and a value, return all subarrays whose sum equals the value (for [1,2,1,3,4,1,1,1,1,5] and 4: [1,2,1],[1,3],[4],[1,1,1,1]). Optimize to better than O(n^2).
No write-up yet. Related questions below have one.
Related ixigo questions
Collected from public candidate posts and coding forums. Updated Nov 2026.