Exercises/#38 Path Sum II
#38

Path Sum II

Medium🌳 Trees
80 XP

Problem

Given the root of a binary tree and a target sum, return all root-to-leaf paths where the sum equals targetSum.

Examples

Input: root=[5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum=22
Output: [[5,4,11,2],[5,8,4,5]]
treedfsbacktracking
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

38 / 150

Your Solution

⚑ JavaScript
Loading...

to save progress and use AI features