The subset sum to target

sir, i’ve done this question using top down dp but still getting TLE in one test case rest of the works fine…
is this problem should be done by bottom up only to get all test cases pass…?

@nikhilmeena
both approaches should work