Duplicate cases also got printed

@pankajpoply45 hey ,remove duplicates from array in starting,then you will get correct ans.

where i didn’t get you.Explain a bit where?

@pankajpoply45 hey from original array which is given remove duplicates ,it will work.

can u send me edited code please i am not getting you if i remove duplicates from orignal array then how ans such as 1 1 6 will appear in ans.

can anyone help me out in this ?

@pankajpoply45 hey check this corrected code: