What is the running time of the following piece of code ?
int i=1, s=1;
while(s<=n){
i++;
s+=i;
}
Difficulty level
This exercise is mostly suitable for students
O(sqrt(n))
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Printing a sequence of instructions on a machine with 1 register and 6 instructions