728x90
https://leetcode.com/problems/sqrtx/
pow함수를 사용하지 않고 sqrt 기능 구현하기
int mySqrt(int x) {
long n = 1;
while(n*n <= x){
n++;
}
return n-1;
}
728x90
'알고리즘 > LeetCode' 카테고리의 다른 글
[LeetCode/easy/BinarySearch] Intersection of Two Arrays II (1) | 2022.09.21 |
---|---|
[LeetCode/easy/BinarySearch] First Bad Version (0) | 2022.09.21 |
[LeetCode/easy/TwoPointer] Reverse String II (0) | 2022.09.20 |
[LeetCode/easy/TwoPointer] Assign Cookies (0) | 2022.09.20 |
[LeetCode/easy/TwoPointer] Intersection of Two Arrays (0) | 2022.09.20 |