|All-time Popular Problems|
|Maximum difference between node and its ancestor|
|Delete a node from BST|
|K’th smallest element|
|Detect cycle in a directed graph|
|Element with left side smaller and right side greater|
|Sort The Array|
|Level order traversal Line by Line|
|Add two numbers represented by linked lists|
|Root to leaf path sum|
Given a binary tree containing N+1 nodes and an integer X. Your task is to complete the function countSubtreesWithSumX(), that returns the count of the number of subtress having total node’s data sum equal to a value X.
Input : Binary Tree: 5 / \ -10 3 / \ / \ 9 8 -4 7 x = 7 Output : 2 1st one is leaf node: 7. 2nd one is: -10 / \ 9 8
The function takes a two argument as input, the reference pointer to the root of the binary tree and an integer denoting the value of X.
There will be T testcases and for each test case the function will be called separately.
For each test case the function should return the required answer.
-103 <=Node Value <= 103
5 -10 L 5 3 R -10 9 L -10 8 R 3 -4 L 3 7 R
1 2 L 1 3 R