Quote:
I don't know why is this returning the, whereas debugging is good
That is impossible, you can't get a correct result because the code is wrong.
Reread your code and pay attention to what you do with
temp
.
Your requirement say:
Quote:
Change in the input array itself. You don't need to return or print elements. Don't use extra array.
but you are using a new array
temp
. Try to change your code accordingly, it is not really complicated.