Company: Flipkart Grid SDEintern_18july
Difficulty: easy
A bakery shop sells gift boxes that consist of distinct weighted handmade cookies. To increase their sales, they use a different packing strategy. Write a program to find the box number of a cookie whose weight is Wx , when the number of cookies N and the weight of each cookie Wi are given. Packing strategy A box comprises three portions: a smaller box in the center, a cookie on the left and a cookie on the right. The weight of the cookies present in the box in the center is less than the weight of both the left and the right cookie. The cookie on the right side of the box is the heaviest. With the cookies sorted so that C1 < C2 < C3 < C4 < C5 < C6 < C7 , the arrangement is [C6[C4[C2[C1]C3]C5]C7] The innermost cookie box is the first box; it is nested inside the second box, which in turn is nested inside the third box, and so on. The first box contains only one cookie, the lightest one. A box is denoted using the square brackets [ and ] . Read the input from STDIN and