What is the time complexity of C++ sqrt() or Java Math.sqrt() function considering a number upto 10^18 (worst case)? I know its not going to be O(1).
It totally depends on its implementation but you can consider O(logn) time complexity in worst case.
1 Like