Harpreet's Newsletter

Harpreet's Newsletter

Path Sum

LinkedIn Interview Question

Harpreet Singh's avatar
Harpreet Singh
Mar 30, 2026
∙ Paid

Problem Overview

Difficulty: Easy
LeetCode Pattern: DFS

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.

Note: A leaf is a node with no children.

Tree:
    1
   / \
  2   3
 /     \
4       5

Example 1:
· Input: targetSum = 9
· Output…
User's avatar

Continue reading this post for free, courtesy of Harpreet Singh.

Or purchase a paid subscription.
© 2026 Harpreet Singh · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture