contiguous elements of the list

This Question Was Asked By Lyft

Given a list of integers and a number K, return which contiguous elements of the list sum to K.

Write a function solve that have the following parameter(s):
1.) arr = array of integer
2.) k = integer

Example
Input:
[1, 2, 3, 4, 5]
k = 9
Output:
[2, 3, 4]

Explanation
A list of integers is given, [1, 2, 3, 4, 5] and K equals to 9, so it will return [2, 3, 4] since 2 + 3 + 4 = 9.

Constraints
• The value of the array should be greater than 0 and less than 100.
• The list of integers should be greater than 0 and less than 100.