Out of four i am passing only two test cases

This is a simple stack problem don’t do these many things just put the values into a stack and compare one by one by popping out.

i have no knowledge of stacks
i have just started data structures

Learn these basic topics. They are primary tools for competitive programming

currently i am practicing linked list

so could u please suggest a method using linked list why i am not passing other two test cases

It’s quiet difficult to see where you went wrong its a really complicated code to understand

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.