Subset Sum Easy Problem


My code isn’t working.

@Kinjal
hello Kinjal,
U need to store result of function call made in line no 12 and 13, and then return total count


Bhaiya, can you kindly look up the code because I have made some changes but I didnt get the output!
So, if you just point out the problem why it isn’t working that will be grateful!

@Kinjal
hello Kinjal,
your code is almost correct now but need bit modifications
a) input format ->


you need to run you code for t different test case
b) there will always be one empty set whose sum will be zero so print yes only when there exists more than one set (i.e count > 1)


Bhaiya, still not giving any output.

@Kinjal
you need to print each output in newline but u are printing them in same line add ‘\n’ and ur code works fine

You are right, Bhaiya. I have changed it. It’s giving all output.
Bhaiya, are you a Competitive Programmer?

@Kinjal
yeah kind off

So, how much important Hacker Blocks for CP in your case and why?

@Kinjal
I practice from different platform.
platform - problems solved
codechef - more than 250
hackerearth - more than 500
hackerblocks - more than 250
leetcode - more than 125
codeforces - more than more than 70
hackerrank - more than 300

for me its all about practice . I never pick any specific platform for plactice . if i learn any topic x then i practice from any of these platform.
in my opinion hackerblocks , hackerrank and hackerearth is good for begineers

That’s a very informative. So, did you take Competitive Programming course from here for initials? I mean, how you start the journey to this Sport Programming?

@Kinjal
In my 2nd year I started solving problems on hackerrank then i did algo++ course from cb and after that practice practice and practice.
cp is like sport the more u practice ur game will improve in same way

And how you practiced problems? Did you look up other codes many times? So how you approach a specific problem, can you kindly tell me in step wise? I mean, you have told me before how to learn new thing that first solve the problem by myself with no time bound and if I cant then see others way to solve the same problem. But, if I can solve the problem which I can some of the problems so still should I have to see others way of doing the same problem? Share your experiences, How you did it back then when you’re like me? What’s your advice for me, like you think that if you would have do that before in Sport Programming? Please tell me all the questions answer if possible.
P.S. Actually I need to know all my questions answer because I want to be a best Sport Programmer.
Thank you.

@Kinjal
a) particiapte in contest as much as you can
websites -> hackerearth circuits( 7 day long challengs )
- hackerearth easy ( 2.5 hrs challenge)
- codechef long challenge ( 10 days long challenge)
- codechef lunchtime ( 2.5 hrs)
- codechef cookoff (2.5 hrs)
- codeforces rounds (div 3 ,div2)
- leetcode weekly contest (for interviews)
- leetcode biweekly contest (for interviews)
b) Now let say u participated in some of above listed contest and u solve only x number of problems in any contest .
actual learning starts from here, read x+1 th question again , find from which topics this question is framed .
if u find any unfamiliar topic then read it( some time u find resources sometime not ) solve 4 ,5 easy problems based on the newly learnt topic.
read problem again try solving it on ur own if still not able to solve it then look for ediorial if present.
after reading try solving on ur own. once solved check how others have solved the same problem.
c) long challenges like hackerearth circuits and codechef long is must for begineers.
d)apart from contests let say u find topic x tough then go to any website find all problems related to that topic sort them in easy->medium->hard order
solve some easy problem ,some medium and some hard(if u can)

d)repeat

1 Like

okay, Bhaiya. Thank you for your response.

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.