in this code leftans will always be null during recursive calls.when will it become not equal to null.
Code working of leftans
@jindaldivish hey left ans will be NULL when you will find LCA in left subtree,recursion left pr call hui to it will not be NULL when you get LCA in left subtree.Hope you get it.