当前位置:网站首页>不会就坚持67天吧 平方根
不会就坚持67天吧 平方根
2022-07-29 04:13:00 【一只小小明】
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;
}
}
作者:LeetCode-Solution
链接:https://leetcode.cn/problems/jJ0w9p/solution/qiu-ping-fang-gen-by-leetcode-solution-ybnw/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
边栏推荐
- When defining an array, the size must be constant
- Codeforces round 810 (Div. 2) d. rain (segment tree difference)
- View partition table format
- 全屋WiFi方案:Mesh路由器组网和AC+AP
- Problems encountered in vscode connection SSH
- 有一种密码学专用语言叫做ASN.1
- Asp. Net MVC, how can the controller in the folder jump to the controller in the root directory?
- Asp.net MVC中文件夹中的控制器如何跳转到根目录的控制器中?
- SQL time fuzzy query datediff() function
- Zhihuijun, a genius of Huawei, made a modular mechanical keyboard, which caused an earthquake in the geek circle. Netizens: This is the real customization
猜你喜欢
[kvm] create virtual machine from kickstart file
安装ros的laser_scan_matche库所遇到的问题(一)
The solution of porting stm32f103zet6 program to c8t6+c8t6 download program flash timeout
[principle] several ways of horizontal penetration
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)
Fu Yingna: Yuan universe is the new generation of Internet!
MySQL gets the maximum value record by field grouping
Some problems about pointers
Zhihuijun, a genius of Huawei, made a modular mechanical keyboard, which caused an earthquake in the geek circle. Netizens: This is the real customization
BGP的基础配置---建立对等体、路由宣告
随机推荐
The solution of porting stm32f103zet6 program to c8t6+c8t6 download program flash timeout
基于STM32和阿里云的环境检测系统设计
How to query the submission number of a version
当我从数据库获取到了winfrom特定的控件ID之后我需要通过这个ID找到对应的控件,并对控件的TEXT文本进行赋值这该怎么做
Deep understanding of browser caching mechanism (HTTP)
顺序表和链表
优炫数据库有办法查到主集群每天传给备集群的日志量吗?
The principle of inverse Fourier transform (IFFT) in signal processing
"Weilai Cup" 2022 Niuke summer multi school training camp 2H
Beginner: array & String
BIO、NIO、AIO的区别和原理
What the hell is this error? It doesn't affect the execution result, but it always reports errors when executing SQL... Connecting maxcomputer uses
[paper translation] vectornet: encoding HD maps and agent dynamics from vectorized representation
有一种密码学专用语言叫做ASN.1
GBase 8a特殊场景下屏蔽 ODBC 负载均衡方式?
The data source is SQL server. I want to configure the incremental data of the last two days of the date field updatedate to add
SQL time fuzzy query datediff() function
The function "postgis_version" cannot be found when installing PostGIS
pat A1041 Be Unique
SVG--loading动画