Golang | Leetcode Golang题解之第492题构造矩形

题目:

题解:

Go 复制代码
func constructRectangle(area int) []int {
    w := int(math.Sqrt(float64(area)))
    for area%w > 0 {
        w--
    }
    return []int{area / w, w}
}
相关推荐
LuminousCPP32 分钟前
单链表专题(四)-刷题复盘篇-LeetCode 138 随机链表复制|原地拷贝法突破复杂指针操作
数据结构·笔记·算法·leetcode·链表
存在morning1 小时前
【Python 开发实践 一】Python vs Go vs Java 三门语言对比
java·python·golang
Forever Nore1 小时前
LeetCode 14 最长公共前缀 - 纵向扫描
linux·服务器·leetcode
圣保罗的大教堂1 小时前
leetcode 3090. 每个字符最多出现两次的最长子字符串 简单
leetcode
圣殿骑士-Khtangc13 小时前
Go字符串高效拼接性能对比与底层原理分析
服务器·前端·golang
旖旎夜光14 小时前
LeetCode 3:无重复字符的最长子串(滑动窗口) —— 题解
数据结构·c++·算法·leetcode·滑动窗口
Navigator_Z17 小时前
LeetCode //C - 1192. Critical Connections in a Network
c语言·算法·leetcode
rannn_11117 小时前
【力扣hot100】链表专题下|138、148、23、146
java·算法·leetcode·链表·开发
xzlAwin18 小时前
Win10安装Go语言多版本管理器g工具
开发语言·golang
hanlin0319 小时前
刷题笔记:力扣第189题-轮转数组
笔记·算法·leetcode