Given a binary tree, you need to find the number of all root to leaf paths along with their path lengths.
Input: 3 2 4 Output: 2 2 $ Explanation : There are 2 roots to leaf paths of length 2.
Input: 10 20 30 40 60 Output: 2 1 $3 2 $ Explanation: There is 1 root leaf paths of length 2 and 2 roots to leaf paths of length 3.
Your task is to complete the function pathCounts that prints the number of all root to leaf paths along with their path length separated by space.
1 <= T <= 30
1 <= Number of nodes <= 100
1 <= Data of a node <= 1000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes