当前位置:网站首页>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 .
边栏推荐
- C语言:联合体知识点总结
- Machine vision Series 2: vs DLL debugging
- flink-sql 如何设置 sql执行超时时间
- 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
- GBase 8a特殊场景下屏蔽 ODBC 负载均衡方式?
- (.*?) regular expression
- 不会就坚持60天吧 神奇的字典
- How to solve the problem of store ranking?
- Common components of solder pad (2021.4.6)
- 14. Haproxy+kept load balancing and high availability
猜你喜欢

Jenkins 参数化构建中 各参数介绍与示例

全屋WiFi方案:Mesh路由器组网和AC+AP

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

Applet: Area scrolling, pull-down refresh, pull-up load more

Is the array name a pointer

12.优先级队列和惰性队列

伏英娜:元宇宙就是新一代互联网!

Function pointer and callback function

Object detection: object_ Detection API +ssd target detection model

Common components of solder pad (2021.4.6)
随机推荐
Lua language (stm32+2g/4g module) and C language (stm32+esp8266) methods of extracting relevant data from strings - collation
Mmdetection preliminary use
伏英娜:元宇宙就是新一代互联网!
不会就坚持69天吧 合并区间
请问,在sql client中,执行insert into select from job时,如何单
(.*?) regular expression
14. Haproxy+kept load balancing and high availability
不会就坚持60天吧 神奇的字典
Implementation of jump connection of RESNET (pytorch)
The structure pointer must be initialized, and the pointer must also be initialized
你真的会写Restful API吗?
"Weilai Cup" 2022 Niuke summer multi school training camp 1 J serval and essay (heuristic merger)
Interview notes of a company
10.回退消息
如何查询版本的提交号
Problems encountered in vscode connection SSH
不会就坚持68天吧 狒狒吃香蕉
SQL time fuzzy query datediff() function
Machine vision Series 1: Visual Studio 2019 dynamic link library DLL establishment
Is the array name a pointer