Problem Description
You are given the root of a binary tree A. You have to find out the number of parent - child relationship whose values are consecutive numbers.
A = 2
/ \
1 3
Input 2:
A = 5
/ \
1 3
/ \
1 4
2
Output 2:
1
(2, 1) and (2, 3) are the consecutive parent - child relationships.
Explanation 2:
(3, 4) is the only consecutive parent - child relationship.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.