The subset sum to target

Please help, why is it failing a few test cases…

@Karanveer
logic and code both are correct

the run time errror is due to size issue
max size of dp array is 10^3 * 10^5=10^8 which should be declare globally otherwise give runtime error

only change you have to make is declare dp array globally.that ll pass all the test case
Hope this helps.Please mark ur doubt as resolved :grinning: