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}
}
相关推荐
让我上个超影吧4 小时前
【力扣26&80】删除有序数组中的重复项
算法·leetcode
漫随流水5 小时前
leetcode回溯算法(78.子集)
数据结构·算法·leetcode·回溯算法
We་ct6 小时前
LeetCode 151. 反转字符串中的单词:两种解法深度剖析
前端·算法·leetcode·typescript
wen__xvn7 小时前
代码随想录算法训练营DAY25第七章 回溯算法 part04
算法·leetcode·深度优先
June bug7 小时前
(#字符串处理)字符串中第一个不重复的字母
python·leetcode·面试·职场和发展·跳槽
AlenTech8 小时前
197. 上升的温度 - 力扣(LeetCode)
算法·leetcode·职场和发展
源代码•宸9 小时前
Leetcode—404. 左叶子之和【简单】
经验分享·后端·算法·leetcode·职场和发展·golang·dfs
WBluuue10 小时前
数据结构与算法:dp优化——优化尝试和状态设计
c++·算法·leetcode·动态规划
im_AMBER10 小时前
Leetcode 105 K 个一组翻转链表
数据结构·学习·算法·leetcode·链表
sin_hielo10 小时前
leetcode 1877
数据结构·算法·leetcode