Leetcode专题[数组]-69-x的平方根

LabRat / 41 /

ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。
https://ckai.xyz

leetcode链接:
https://leetcode.cn/problems/sqrtx/solutions/5544/0mser-fen-c...
解题思路:
寻找

func mySqrt(x int) int {
    // 顺序查找,定位平方根
    for i:=0; i<=x; i++ {
        if i*i > x {
            return i-1
        }
    }
    return x
}

Leetcode专题[数组]-69-x的平方根
作者
LabRat
许可协议
CC BY 4.0
发布于
2023-09-02
修改于
2024-04-04
Bonnie image
尚未登录