Please help me out in this extra cases are also printing

@pankajpoply45
In this question, you don’t have to print duplicate ans. So what you can do is instead of printing vector v in ans() function itself, you can sort it and store in some set. And later you can print it inside main function

still not getting correct ans

https://ide.codingblocks.com/s/239900 check the code

@pankajpoply45
line 30 should be ans(a,j+1,sum,v,n,s,g); second argument should be j+1 not i+1