Skip to content

Commit

Permalink
prashant3
Browse files Browse the repository at this point in the history
  • Loading branch information
prashant2-4-4 committed Oct 19, 2021
1 parent 60ae253 commit 5047fc1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cansum tabulation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def cansum(lst , n):
table = [False] * (n+1)
table[0] = True

for i in range(n+1):
if(table[i]):
for j in range(len(lst)):
a = i + lst[j]
if(a < n+1):
table[a] = True
return table[-1]


lst = list(map(int , input().split()))
n = int(input())
a = cansum(lst,n)
print(a)

0 comments on commit 5047fc1

Please sign in to comment.