HackerRank: Continuous Sequence Sum Test

Question:

Given a sequence of positive integers A and an integer T, return whether there is a continuous sequence of A that sums up to exactly T
Example

[23, 5, 4, 7, 2, 11], 20. Return True because 7 + 2 + 11 = 20
[1, 3, 5, 23, 2], 8. Return True because 3 + 5 = 8
[1, 3, 5, 23, 2], 7 Return False because no sequence in this array adds up to 7


Solution

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.