Back to problems

Binary Tree Paths With Target Sum

Algorithm · ByteDance · Medium

Path Sum II Medium · Topics · Company Tags · Hints You are provided with the root node of a binary tree and an integer targetSum. Your task is to identify every root-to-leaf path where the sum of the node values along the path equals targetSum. A leaf node is defined as a node with no children (both left and right pointers are null). For each matching path, collect the node values in the order they are visited from the root down to the leaf. Return these sequences as a list…

Checking your access…