Google | Phone Screen | Max Size Subarray Sum Equals k
Anonymous User
4462

You are given an array of prices of different icecreams. But your wallet has budget dollars. Find the length of the longest contiguous subarray whose total price would be equal to your budget.

Example 1:

Input: prices = [2, 5, 7, 8, 9, 18, 2, 2], budget = 14
Output 3
Explanation: 2 + 5 + 7 = 14
Comments (8)