Arrays and prefix sums: Given an integer array nums and an integer target, return the number of contiguous, non-empty subarrays whose sum equals target.
Input: A JSON object { "nums": number[], "target": number }.
Output: A JSON integer equal to the number of matching contiguous subarrays.
Constraints:
- 0 <= nums.length <= 100000
- nums may contain negative values and zero
- The result fits in a safe JSON integer
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: EASY. Variant: 4. Balance correctness, maintainability, and clear review-ready code.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked easy difficulty.
The signed-in workspace provides the tools required by the round, such