how to swap these elements
@kartik-malik, You can just use the swap() function in STL.
my code is not working
@kartik-malik, You should try dry run on paper and pen.
thanks it worked…