Coding Gurukul: Revision Challenge
Practice this coding question on Coding Gurukul.
Problem statement
A learner solves 1 problem on day 1, 2 on day 2, 3 on day 3, and so on. Given a target T, find the first day when the total solved is at least T. Use a loop to accumulate the daily work until the target is reached. For T = 8, the totals are 1, 3, 6, 10, so the answer is day 4.
Input format
One integer T, the target number of solved problems.
Output format
Print the minimum number of days needed.
Constraints
1 ≤ T ≤ 1000000000
Sample input
8
Sample output
4
Sign in to run or submit a solution in C++, Java or Python.