Leetcode 1261. Find Elements in a Contaminated Binary Tree
Given a binary tree where every node value is contaminated as -1 but the original labels follow root = 0 and for node x, left = 2x+1 and right = 2x+2, recover the correct values and implement find(target) to return whether a node with that label exists in the recovered tree. The solution must support up to 10^4 nodes and 10^4 find queries efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.