Pls tell error in code
hello @Vaibhav277 one thing i felt wrong is about the logic you were doing with the ouput vector .
so that’s why i have modified your code and now it is giving correct ouput.
please find the correct code below .
if you feel your doubt is cleared please mark this doubt as resolved.
i hope i have cleared your doubt .
Happy Learning !!
Sir can you pls explain why using a vector is wrong over there… basically i am generating subsets and storing in vector and then calculating sum… if sum comes out to be 0 then i am returning true
see @Vaibhav277 the problem is if you can see the test case in the above code which i shared .
it is printing wrong answer for the test case .
this is because the elements in your vector are not producing correct result.
for certain problems there are certain optimised 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.