guessing the game

getting tle in guessing game bcoz of nested loops , any alternative??

Try different approach, be more mathematical, just a hint: there is no Nested loop required.

No more hints, cos its ongoing Contest. more detailed hints will be against rules

okay thanks

How did you decide, you are getting TLE becoz of nested loop ?
If your nested loops are if & else only, they won’t effect your time much, they are O(1).

Hint : Most probably, problem is somewhere else.

somewhere else means???

If you are using some loops such as for and while which run for long time with large inputs then it will show TLE because your program didnt stop in the stipulated time.

1 Like

the solution is o(1) for each test case :smiley: . 3-5 line answer(excluding includes and declarations). purely mathematical.