Created
February 19, 2020 05:50
-
-
Save BharathKumarS/ebc6118eeb7e64dcc4e480ea9d26b648 to your computer and use it in GitHub Desktop.
Birthday Chocolates from HackerRank
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
#This is a test case check. Please check my git repo for the actual solution to go into HackerRank | |
def choco(s,d,m): | |
can = 0 | |
if len(s) > 1: | |
for sq in range(len(s)-m): | |
if sum(s[sq:sq+m]) == d: | |
can += 1 | |
else: | |
if s[0] == d: | |
can = 1 | |
print(can) | |
s = [2,5,1,3,4,4,3,5,1,1,2,1,4,1,3,3,4,2,1] | |
d = 18 | |
m = 7 | |
choco(s,d,m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment