The TransCompilator

Solved LeetCode program · 730 of 1,000

#0965 · Univalued Binary Tree

Easy Depth-First Search chunk-15.md

Original English source

Keep a shared values holding 1, 1, 1, 1, 1, 1, and 1. Keep a shared lefts holding 1, 3, 6, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, -1, and -1. Keep a shared answer of 1.
To walk from node (a whole number). If node is less than 0, return. If item node of values is not item 0 of values, set answer to 0, return. Walk from item node of lefts. Walk from item node of rights.

Walk from 0. If answer is 1, show true, otherwise show false.

Open in Playground Browse all 1,000 problems

Expected stdout

true