Solved LeetCode program · 100 of 1,000
#0100 · Same Tree
Original English source
Keep a shared valuesone holding 1, 2, and 3. Keep a shared leftone holding 1, -1, and -1. Keep a shared rightone holding 2, -1, and -1. Keep a shared valuestwo holding 1, 2, and 3. Keep a shared lefttwo holding 1, -1, and -1. Keep a shared righttwo holding 2, -1, and -1. Keep a shared same of 1.
To compare at 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 valuesone is not item second of valuestwo, set same to 0, return. Compare at item first of leftone with item second of lefttwo. Compare at item first of rightone with item second of righttwo.
Compare at 0 with 0. If same is 1, display true. Otherwise, display false.
Expected stdout
true