This was one of the question asked in the Online Round of DarwinBox for the role of Product Development Engineer Intern + Full Time
Base pay: 8.0L
CTC: 16.0L
Intern Stipend: 25k per month
In Charlie and the Chocolate factory , the factory owner decided to select the winner by a competition. In the competition there are N chocolates and they have to calculate in how many days they can eat N chocolates provided some condition. On the first day, it is allowed to eat max 1 chocolate. If he eats i chocolates on a given day, he can eat i,i+1 or i-1 chocolates on the next day. On the last day, he can’t eat more than 1 chocolate. Now Charlie wants to win the game. He is good at programming so he thinks to find the answer by programming . Now help Charlie to win the competition.
The first line contains an integer T (1 <T <1000) denoting the number of test cases.
Each of the next Tlines contains an integer N (1< N< 10^9).
Output T lines. On each line output the minimum number of days for each test case,
3
9
1
4
5
1
3
Case 1:1 + 2 + 3 + 2 + 1
Case 2:1
Case 3:1 + 2 + 1