The TransCompilator

Solved LeetCode program · 193 of 1,000

#0222 · Count Complete Tree Nodes

Medium Binary Search chunk-04.md

Original English source

Keep a shared values holding 1, 2, 3, 4, 5, and 6. Keep a shared lefts holding 1, 3, 5, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared total of 0.
To gather from node (a whole number). If node is less than 0, return. Add 1 to total. Gather from item node of lefts. Gather from item node of rights.

Gather from 0. Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

6