Please check my code: -
Sample testcase passed successfully
Please check my code: -
Sample testcase passed successfully
When n=1, you are not checking if the stack is empty or not. If it is empty, you have to display No Code.
This is mentioned in the question.