-
-
Save Peilonrayz/7796a1e96818779693436bfb1de64f7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def contiguous_sum(numbers, target): | |
end = 0 | |
total = 0 | |
for value in numbers: | |
total += value | |
if total == target: | |
return True | |
while total > target: | |
total -= numbers[end] | |
end += 1 | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment