leetle

Daily challenge for 2025-05-27

147. Subarray Sum Equals K

Write a function solve that finds the total number of subarrays whose sum equals k.

Example:
Input: nums = [1,1,1], k = 2
Output: 2
Explanation: Subarrays [0,1] and [1,2] have sum = 2.

Run this challenge interactively in Python or JavaScript when the app loads.