sajid161

19:1

May 15th, 2021
506
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution{
  2.   public:
  3.     long long int floorSqrt(long long int x)
  4.     {
  5.     double l=0,r=x;
  6.     for(int i=0;i<100;i++)
  7.     {
  8.         double mid=(l+r)/2.0;
  9.         if(mid*mid>x) r=mid;
  10.         else l=mid;
  11.     }  
  12.     return floor(l);
  13.     }
  14. };
RAW Paste Data