The TransCompilator

Solved LeetCode program · 101 of 1,000

#0101 · Symmetric Tree

Easy Depth-First Search chunk-03.md

Original English source

Keep a shared values holding 1, 2, 2, 3, 4, 4, and 3. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared same of 1.
To mirror from first (a whole number) with second (a whole number). If same is 0, return. If first is -1 and second is -1, return. If first is -1, set same to 0, return. If second is -1, set same to 0, return. If item first of values is not item second of values, set same to 0, return. Mirror from item first of lefts with item second of rights. Mirror from item first of rights with item second of lefts.

Mirror from 1 with 2. If same is 1, show true, otherwise show false.

Open in Playground Browse all 1,000 problems

Expected stdout

true