u just have to check if structure is same or not… values can be different also…
i have corrected ur code…
its working fine now and passing all test cases

where was the error please mark in the code

ur areIdentical() function is not correct… refer to what i have written in my code… i said na u were comparing on basis of values of nodes as well while we are just interested in structure only…

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.