The TransCompilator

Solved LeetCode program · 320 of 1,000

#0437 · Path Sum III

Medium Depth-First Search chunk-07.md

Original English source

Keep a shared values holding 10, 5, -3, 3, 2, 11, 3, -2, and 1. Keep a shared lefts holding 1, 3, -1, 6, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, 7, 8, -1, -1, -1, and -1. Keep a shared target of 0. Keep a shared found of 0.
To probe from node (a whole number) with total (a whole number). If node is less than 0, return. The sum is total plus item node of values. If sum is target, add 1 to found. Probe from item node of lefts with sum. Probe from item node of rights with sum.

Set target to 8.
For every start from 0 to 8.
Probe from start with 0.

Show found.

Open in Playground Browse all 1,000 problems

Expected stdout

3