Amazon | Online Onsite | Sum of nodes whose kth parent is even
Anonymous User
2295

We are given a Binary Tree and a number k. We want to find the sum of all nodes whose kth parent is even.
0 <= k <= 10^7

Example:
k = 2
			   4
			/     \
		 6          8
	 /     \
   8          5

The kth parent of 8 and 5 is 4 which is even and therefore the answer is 8+5=13 for this example.
Comments (9)