Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Identify The Level

By subhashis_cse · Limits 1s, 512 MB

Amin and Belal are two friends. Both have good knowledge about graph and tree
in data structure part. Now they discuss about some problems of Codeforces
which are related to these topics. Amin now figure out a binary tree which are
consists of some nodes and edges.
A binary tree is a tree in which each node has at most two children, which are
referred to as the left child and the right child. The following figure contains a
binary tree.

Without fill up one level it can not go another level of the tree and node number
is sequentially such as a figure.Now Amin asked Belal the minimum level of a
node. Belal asked your help and I think you are a good programmer.So please
help Belal and build the tree efficiently to get minimum level of a node.


Input starts with an integer T (1<=T<=100000)-no of test cases and for each cases
an integer number N(1<=N<=100000)-denoting the numbre of nodes.


Output the minimum level no of the node of the binary tree.!


Case 1: 1
Case 2: 2



96% Solution Ratio

Cloud_Earliest, Mar '20

ishtupeedFastest, 0.0s

tusharLightest, 1.3 MB

silenced.VOICEShortest, 84B


Login to submit

Related Contests

Toph uses cookies. By continuing you agree to our Cookie Policy.