Subset Sum Easy TLE


exceeding time and wrong o/p

@mddanish
Your code fails for multiple testcases as most variables in your code retain their older values across testcases hence giving the problems that you are facing.
Make these changes to resolve these problems

  1. Initialise c = 0 for every testcase or your code simply works for the first testcase and ruins every other following testcase.
  2. Initialise your vector s inside the testcase loop and not before or your vector retains its previous values.