Your question is Algorithm Coding Exercise. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given an integer array nums and an integer target, return the number of contiguous subarrays whose elements sum exactly to target.
A subarray is a contiguous slice of the array. Your function should count all valid subarrays, including overlapping ones.
nums: a list of integerstarget: an integertargetdef count_subarrays_with_sum(nums, target):