No output being returned

@mohammadabdullahjawwad
After line 83 and line 94 add return result

But I’ve already returned result in lines 88 and 93! How will it help

@mohammadabdullahjawwad
In case node value is equal to p or q and but you dont have the other value your code is returning NULL instead of result
See once

But I check for the above said conditions in the lines 91-97

@mohammadabdullahjawwad
Please do as I said once