Lca problem binary tree

in video sir said that this method is for the tree which has unique values in it but where sir used root->val==p->val if instead of this we write root==p then i think the tree has unique values or not it doesnt matter

Yes, if you just check addresses it does not matter whether values are equal or not.