xyz Interview Question for SDE1s
- 0of 0 votes
Steps to get out of complete binary tree- bibhuprasadpala107 July 02, 2019 in India
You are given two integers A and B. A describes the number of nodes in complete binary tree.
You are B steps away from your destination in the worst case.
Initially, you can be at:
The root node of the tree and can only move bottom of the tree.
Any leaf node of the tree and can only move up the tree.
Find and return an array of integers C of size 2
C: The number of nodes which are at B steps from the root, i.e. the number of nodes such that,
starting at that root, you have to take
B steps downwards to reach the node.
C: The number of nodes such that the maximum distance from the node to any leaf in the subtree of the node is B.
| Report Duplicate | Flag | PURGE
Open Chat in New Window