Prefix Sum problem

Problem Statement Given an array of integers and an integer k. Find the total number of continuous subarrays whose sum equals k. Solve this problem using a prefix sum.Example 1:Input:nums = [1,1,1], k = 2Output:…