I can do it by reversing the original LL and copying it into a new LL but is there a way to do it without a helper LL?
Is there a way to solve this question without taking an extra LL?
hello @suhaib0900
yeah there are many ways.
a) use stack , first push all ur node data in the stack(by iterating from left to right) .
b) after the above step, iterate the given list and check whether it is matching with the top of the stack or not.
if it matches then pop top element and continue to next element
otherwise return false
another way is break the list from mid, reverse the first list and then compare with other list(check ur course content).
Ok Got it. Thanks. You can close the thread.
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.