반응형
https://leetcode.com/problems/sqrtx/
Sqrt(x) - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
sqrt함수를 사용해보는 간단한 문제였습니다.
📕 풀이방법
📔 정답출력
sqrt(x)를 반환합니다. 함수의 반환형이 int이므로 실수부를 생략할 수 있습니다.
📕 Code
📔 C++
#include <bits/stdc++.h>
class Solution {
public:
int mySqrt(int x) {
return sqrt(x);
}
};
*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.
'Algorithm > Implementation' 카테고리의 다른 글
(C++) - LeetCode (easy) 119. Pascal's Triangle II (2) | 2022.11.28 |
---|---|
(C++) - LeetCode (easy) 118. Pascal's Triangle (0) | 2022.11.27 |
(Python) - LeetCode (easy) 67. Add Binary (0) | 2022.11.09 |
(Python) - LeetCode (easy) 66. Plus One (0) | 2022.11.08 |
(C++) - LeetCode (easy) 13. Roman to Integer (2) | 2022.10.11 |