Kindly tell the error in my code it's failing a test case

https://practice.geeksforgeeks.org/problems/delete-middle-element-of-a-stack/1/?category[]=Stack&category[]=Stack&problemStatus=unsolved&difficulty[]=-1&difficulty[]=0&page=1&query=category[]StackproblemStatusunsolveddifficulty[]-1difficulty[]0page1category[]Stack#

@laksh.rustagi12
your code is giving wrong answer for even sizeOfStack, as per your logic you should take n as

int n = (sizeOfStack)/2 + 1;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.