Ai
1 Star 0 Fork 0

catyMap/AlgorithmNote

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
judgeSquareSum.go 333 Bytes
Copy Edit Raw Blame History
catyMap authored 2021-04-29 08:16 +08:00 . 4/29更新 添加双指针,二分查找等题目
package main
import (
"fmt"
"math"
)
func judgeSquareSum(c int) bool {
high , low := int(math.Sqrt(float64(c))) , 0
for high >= low {
v := high * high + low * low
if v == c {
return true
} else if v > c {
high --
}else {
low ++
}
}
return false
}
func main() {
fmt.Println(judgeSquareSum(2147483640))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dogemap/algorithm-note.git
git@gitee.com:dogemap/algorithm-note.git
dogemap
algorithm-note
AlgorithmNote
dc486f96f6c1

Search