Help with error

sol: https://ide.codingblocks.com/s/421453

prob: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/

all test cases are not passing I would like to know my mistake

where is your code which you are submitting on leetcode

oh sorry here it is

image

you have to run the loop from end to check the condition
Modified Code

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.