Round 1
Questions: Alice suddenly got to know she has to bring N ribbons i.e 1 piece of each size between 1-N to school the next day. So she went to ask Bob for help. Bob said he has exactly N+1 ribbons i.e 1 piece of all sizes between 1- (N + 1). Alice can cut a ribbon of any size to whatever size she wants.
Task:
Return the Minimum number of Ribbons she needs to get from Bob.
Function description:
Complete the function solve provided in the editor. This function takes the following 1 parameter and returns the required answer:
• N: Represents the number
Input format:
• The first line contains T denoting the number of test cases. T also specifies the number of times you have to run the solve function on a different set of inputs.
• For each test case:
• The first line contains a single integer N.
Output format:
For each test case, print the required answer in a new line.
Constraints:
1 < T < 10^3
1 ≤ N ≤ 10^15
Sample input:
3 4 7 50
Sample output:
3 5 42
Explanation:
- For the first test case (N = 4): She can get the ribbons of size 5, 4, 1, then she can cut the ribbon of size 5 into ribbons of size 2 and 3, so the answer is 3.
- For the second test case (N = 7): She can get the ribbons of size 8, 7, 6, 4, 3, then she can cut the ribbon of size 8 into ribbons of size 1, 2, and 5, so the answer is 5.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.