Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution{
- public:
- long long int floorSqrt(long long int x)
- {
- double l=0,r=x;
- for(int i=0;i<100;i++)
- {
- double mid=(l+r)/2.0;
- if(mid*mid>x) r=mid;
- else l=mid;
- }
- return floor(l);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement