Showing:
Handle Score
@Ibrahim Nash 6560
@mb1973 5777
@Quandray 5275
@akhayrutdinov 5111
@saiujwal13083 5074
@kirtidee18 4398
@sanjay05 3762
@mantu_singh 3654
@gfgaccount 3601
@marius_valentin_dragoi 3525
Number of root to leaf paths
Medium Accuracy: 52.12% Submissions: 4952 Points: 4

Given a binary tree, you need to find the number of all root to leaf paths along with their path lengths.

Example 1:

Input:
3 2 4

Output:
2 2 $Explanation : There are 2 roots to leaf paths of length 2.  Example 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.

Constraints:
1 <= T <= 30
1 <= Number of nodes <= 100
1 <= Data of a node <= 1000