The TransCompilator

Solved LeetCode program · 415 of 1,000

#0560 · Subarray Sum Equals K

Medium Array chunk-09.md

Original English source

The numbers is a list of 1, 1, and 1. The target is 2. The last is the last position of numbers. The total is 0.
For every start from 0 to last.
The sum is 0.
For every ending from start to last.
The value is item ending of numbers. Add value to sum. If sum is target, add 1 to total.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

2