Created
October 27, 2018 19:12
-
-
Save hansrajdas/cc4a704e1b49e74a2087ae1cf3277e7b 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
# Complete the countSubSequence function below. | |
def countSubSequence(inputSeq, targetSum): | |
size = len(inputSeq) | |
count = 0 | |
for i in range(0, size): | |
for j in range(i + 1, size + 1): | |
subSeq = inputSeq[i:j] | |
if sum(subSeq) == targetSum: | |
count += 1 | |
return count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment