Company: Flipkart_2nov
Difficulty: medium
Cookie Box Arrangement Problem Description 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 W, when the number of cookies is N and weight of each cookie Wi is provided. Packing strategy: 1) The box comprises of three portions: a smaller box in the center, a cookie on the left and a cookie on the right. The weight of cookies present in the box in the center is less than the weight of both left and right cookie. The cookie on the right side of the box is the heaviest. 2) The innermost cookie box will be the first box that will be nested inside the second box, which in turn will be nested inside the third box and so on. The center of the innermost box contains only one cookie. 3) A box is denoted by using the square brackets [] . Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere