OCI | Phone | Find all paths that sum to K in a Binary Tree
Anonymous User
2523

The question was an extension of Path Sum III - https://leetcode.com/problems/path-sum-iii/

You are given a binary tree in which each node contains an integer value.

Find all the paths that sum to a given value.

The path does not need to start or end at the root or a leaf, but it must go downwards (traveling only from parent nodes to child nodes).

Example:

      10
     /  \
    5   -3
   / \    \
  3   2   11
 / \   \
3  -2   1

Return:
[[5, 3], [5, 2, 1], [-3, 11]]
Comments (7)