My issue
My code
# cook your dish here
def max_people_in_towers(towers,n):
if n == 0:
return 0
elif n==1:
return towers[0]
dp = [0]*n
dp[0]=towers[0]
dp[1]=max(towers[0],towers[1])
for i in range(2,n):
dp[i] = max_dp([i-1],dp[i-2]+towers[i])
return dp[-1]
N=5
towers = [1,2,3,1,2]
max_people = max_people_in_towers(towers, N)
print("maximum number of people arya can place:",max_people)
Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone