Блог пользователя tri_e

Автор tri_e, история, 4 года назад, По-английски

HOW TO SOLVE THE INEQUALITY i*(i + 1) <= n such that i is maximum possible in O(1) time complexity.is their exist any method.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This is the one I can think of. Solve $$$i^{2}+i-n=0$$$
So just take floor(sol) from the previous equation.
The problem is that solution involves computing square root which is not O(1).