Algorithm · Google · Medium
Problem: Counting Subarrays with a Target Sum You are given an integer array nums and an integer k. Determine how many continuous subarrays of nums have a total sum of exactly k. Requirements Produce the number of continuous subarrays whose sum equals k. Design the approach to use an efficient amount of time. Function Signature Follow-up (Streaming Data) Suppose the elements of nums arrive one at a time rather than being available as a complete array. Whenever a new value x…