Subarray With Target Sum
Medium · rating 1400 · Sliding Window, Two Pointers, Prefix Sum
The first line contains n and target t. The second line has n positive integers. Print YES if some contiguous subarray sums to exactly t, otherwise NO.
Constraints: 1 ≤ n ≤ 105, 1 ≤ ai, t ≤ 109
Related problems
- Minimum Size Subarray Sum — Medium
- Subarrays With Product Below K — Medium
- Lamp Toggles — Medium
- Product of Array Except Self — Hard
- Container With Most Water — Medium
- Longest Substring Without Repeats — Medium