bottom up approach is giving tle in 2 cases while top down is working perfectly . so how to decide to use which approach ?
Subset Sum to target dp problem
hello @mandeepchohan96
r u sure u r getting tle ?
pls share the screenshot of ur submission.
in my knowledge both approaches should work
@mandeepchohan96
u r getting run error.
becuase it space complexity is O(n*sum) which is too much
ur top down is working because u r using map for memoisation ,if u would have used array then u would have faced same error in that as well
yes sir its RUN error. and how to declare unordered_map for bottom up approach ?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.