Getting segmentation fault in the above problem

can u help me in figuring out why am i facing segementation fault in this code


I tried a lot but not able to find out why m getting so.

Hey @rohangupta569

                for(int i=ans.size()-1;i>=0;i--) //i-- here
                {
                    cout<<ans[i]<<" ";
                }

I f this resolves ur query then please mark it as resolved :slight_smile: