You can just find the square root of k and drop the decimals. That will be faster than binary search
You’re right, that is another way, quicker way to solve this problem. The time complexity of your approach would be O(1).
You can just find the square root of k and drop the decimals. That will be faster than binary search
You’re right, that is another way, quicker way to solve this problem. The time complexity of your approach would be O(1).