当前位置:网站首页>不会就坚持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)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
边栏推荐
- Big manufacturers finally can't stand "adding one second", and companies such as Microsoft, Google meta propose to abolish leap seconds
- 有没有大佬帮我看下flink sql连接kafka认证kerberos的参数配置是否有误
- When array is used as a function parameter, it is better to use the array size as a function parameter
- HCIP BGP
- What the hell is this error? It doesn't affect the execution result, but it always reports errors when executing SQL... Connecting maxcomputer uses
- [untitled]
- Some problems about pointers
- How to write SQL statements about field conversion
- Install the laser of ROS_ scan_ Problems encountered in match library (I)
- 请问为什么我进行mysql数据update时,kafka中采集到的是先删除原纪录(op d)再新增新
猜你喜欢

Data mining -- Introduction to the basis of association analysis (Part 1)

C language to achieve three chess game (detailed explanation)

Fu Yingna: Yuan universe is the new generation of Internet!

Summary on the thought of double pointer

Deep understanding of browser caching mechanism (HTTP)

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

基于STM32和阿里云的环境检测系统设计

AssertionError(“Torch not compiled with CUDA enabled“)

编译与链接

HCIP BGP
随机推荐
MySQL Part 3
Rhel8 patch package production
Lua语言(stm32+2G/4G模块)和C语言(stm32+esp8266)从字符串中提取相关数据的方法-整理
“蔚来杯“2022牛客暑期多校训练营1 J Serval and Essay(启发式合并)
Shielding ODBC load balancing mode in gbase 8A special scenarios?
对一个元素使用多种变形的方法
"Weilai Cup" 2022 Niuke summer multi school training camp 2H
SQL语句 关于字段转换怎么写
Big manufacturers finally can't stand "adding one second", and companies such as Microsoft, Google meta propose to abolish leap seconds
The principle of inverse Fourier transform (IFFT) in signal processing
Interview notes of a company
How to set the SQL execution timeout for flick SQL
rman不标记过期备份
初识C语言(3)
C语言实现三子棋游戏(详解)
The difference between dynamic, VaR and object in fluent
Wechat applet parameter transfer
Press the missing number of interview question 17.04 | | 260. the number that appears only once (including bit operation knowledge points)
Blood cases caused by < meta charset=UTF-8> -- Analysis of common character codes
Leftmost prefix principle of index