Skip to content
C

Find a Subarray with Given Sum

Mediumjavapythonccppjavascript

Given an array of non-negative integers and a target sum, determine whether some contiguous subarray adds up to exactly that sum.

Input Format

The first line contains two integers N and target. The second line contains N space-separated non-negative integers.

Output Format

Print 1 if such a subarray exists, otherwise print 0.

Input (stdin)

Output

Run your code to see output here...