0

Help me in spotting the bug in this code

This is a famous GFG problem : https://www.geeksforgeeks.org/subset-sum-problem-dp-25/ I am using the right algorithm but I can't figure out where the code is failing. Code : https://code.sololearn.com/cCLZfsUYoedu/?ref=app

2nd Sep 2022, 9:04 PM
Meghraj
Meghraj - avatar
1 ответ
0
instead of dp = [[0]*(k+1)]*(n+1) replace by this dp = [[0 for _ in range(k+1)] for _ in range(n+1)] hope it helps
25th Aug 2023, 7:02 PM
Han Tong
Han Tong - avatar