Because of the deletion operation, the positions of elements might change and this may lead to elements having value other than their position. This has not been taken care in your approach, since while deleting you print the position of the element and not its value.
Consider the following case
Deleting the element 4 should print 7, and not 3.
Thanks a lot bro @rahulladda . I don’t know how can i miss such an important information, it is also written separately in question but i missed.
No issues @avishek_pratap, but make sure you have put enough effort in debugging the solution before posting it on the forum.
You can go through other accepted solutions too. Honestly, that is what I did to debug your code.