diff --git a/sqrt.cpp b/sqrt.cpp new file mode 100644 index 0000000..0474112 --- /dev/null +++ b/sqrt.cpp @@ -0,0 +1,13 @@ +class Solution { +public: + int mySqrt(int x) { + if(x<2){ + return x; + } + long long int i=2; + while(i*i<=x){ + i+=1; + } + return --i; + } +};