当前位置:网站首页>Not 67 days, square root
Not 67 days, square root
2022-07-29 04:16:00 【A little Ming】

class Solution {
public int mySqrt(int x) {
int l = 0, r = x, ans = -1;
while (l <= r) {
int mid = l + (r - l) / 2;
if ((long) mid * mid <= x) {
ans = mid;
l = mid + 1;
} else {
r = mid - 1;
}
}
return ans;
}
}
author :LeetCode-Solution
link :https://leetcode.cn/problems/jJ0w9p/solution/qiu-ping-fang-gen-by-leetcode-solution-ybnw/
source : Power button (LeetCode)
The copyright belongs to the author . Commercial reprint please contact the author for authorization , Non-commercial reprint please indicate the source .
边栏推荐
- View partition table format
- Openfeign asynchronous call problem
- 大佬们flink的JDBC SQL Connector现在不支持所有的数据库吗,例如vertica?
- Not for 58 days. Implement prefix tree
- 不会就坚持63天吧 最大的异或
- 对一个元素使用多种变形的方法
- Semantic segmentation correlation
- [hands on deep learning] environment configuration (detailed records, starting from the installation of VMware virtual machine)
- Is the array name a pointer
- SQL server how to judge when the parameter received by the stored procedure is of type int?
猜你喜欢

The principle of inverse Fourier transform (IFFT) in signal processing

11.备份交换机

Can you really write restful API?

How to solve the problem of store ranking?

开课!看smardaten如何分解复杂业务场景
![[Openstack] keystone,nova](/img/de/70b654a29a813c8fe828c4018bd4e7.png)
[Openstack] keystone,nova

HC06 HC05 BT

Blood cases caused by < meta charset=UTF-8> -- Analysis of common character codes

Mmdetection preliminary use

MPU6050
随机推荐
Svg -- loading animation
Wechat applet parameter transfer
rman不标记过期备份
[Openstack] keystone,nova
Multi card training in pytorch
对一个元素使用多种变形的方法
flink-sql 如何设置 sql执行超时时间
When array is used as a function parameter, it is better to use the array size as a function parameter
C语言:联合体知识点总结
Differences and principles of bio, NiO and AIO
MPU6050
有一种密码学专用语言叫做ASN.1
The table of antd hides the pager when there is only one page
开课!看smardaten如何分解复杂业务场景
Why are there so many unknowns when opengauss starts?
When defining an array, the size must be constant
The principle of inverse Fourier transform (IFFT) in signal processing
淘宝商品详情接口(商品详情页面数据接口)
店铺排名问题,如何解决?
The return value of the function is the attention of the pointer, the local variables inside the static limit sub function, and how the pointer to the array represents the array elements