Given the root of a binary tree and two integers p and q, return the distance between the node with value p and the node with value q.
The distance between two nodes is defined as the number of edges on the path between them.
Constraints:
The number of nodes in the tree is in the range
Node.val
All Node.val are unique.
p and q are values in the tree.
Given the root of a binary tree and two integers p and q, return the distance between the node with value p and the node with value q.
The distance between two nodes is defined as the number of edges on the path between them.
Constraints:
The number of nodes in the tree is in the range
Node.val
All Node.val are unique.
p and q are values in the tree.