当前位置:网站首页>Leetcode69. x 的平方根
Leetcode69. x 的平方根
2022-07-30 01:02:00 【Java全栈研发大联盟】
题目传送地址:https://leetcode.cn/problems/sqrtx/submissions/
运行效率:
代码如下:
class Solution {
public static int mySqrt(int x) {
for(int i=0;i<=x;i++){
long powNum = (long) i * i; //这里要小心数字溢出的情况,所以用long类型
if(powNum>x){
return i-1;
}
}
return x;
}
}
边栏推荐
- Vmtouch - under Linux file cache management artifact
- 【Flutter】混合开发之Flutter预加载解决第一次加载页面缓慢问题
- Since the media increase play a short video?From the three aspects
- QTableWidget usage example
- Ubuntu中使用SQLite
- 小白必看|不用编程的labview,ATECLOUD完全满足你的需求
- 排序相关应用
- 【Incubator DAY18】Interesting exchange【Simulation】【Math】
- 更换可执行文件glibc版本的某一次挣扎
- 泰克Tektronix示波器软件TDS1012|TDS2002|TDS2004上位机软件NS-Scope
猜你喜欢

Toutiao We-Media Operation: How to Gain 500+ Fans in Toutiao Today?

nacos集群配置详解

泰克Tektronix示波器软件TDS1012|TDS2002|TDS2004上位机软件NS-Scope

The solution to the bug, the test will no longer be blamed

字符串替换空格

Worthington's tried and tested cell isolation system protocols

He used to cells harvested trypsin & release procedure

Worthington Dissociation Enzymes: Collagenase and Four Basic Profiles

Unity笔记——FairyGUI

Win11的WSL2系统更换磁盘和wsl使用简介
随机推荐
Navicat如何连接MySQL
cp强制覆盖与不覆盖拷贝方法
7.28
旋转数组的最小数字
循环神经网络(RNN)
高德地图jsapi不生效 INVALID_USER_SCODE
Fabric Private Data Case
[Training DAY16] ALFA [convex hull] [computational geometry]
【LeetCode每日一题】——872.叶子相似的树
自学HarmonyOS应用开发(56)- 用Service保证应用在后台持续运行
【mysql】Mysql公用表表达式with as
泰克Tektronix示波器软件TDS210|TDS220|TDS224上位机软件NS-Scope
Replace the executable file glibc version of the one
Fabric 私有数据案例
【LeetCode每日一题】——230.二叉搜索树中第K小的元素
Navicat报错:1045-Access denied for user [email protected](using passwordYES)
msyql set names 字符转换处理
[Experience] Experience Summary - Lessons Learned
重建二叉树
测试员容易陷入的9大误区