Problem 1261 · Medium

Find Elements in a Contaminated Binary Tree

The root is 0 and a child at position x has value 2x+1 (left) or 2x+2 (right), so every value can be recovered and then looked up.

Open the interactive visualisation