본문 바로가기

Algorithm/Implementation

(C++) - LeetCode (easy) 69. Sqrt(x)

반응형

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);
    }
};

*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.