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

题目:

题解:

python 复制代码
class Solution:
    def constructRectangle(self, area: int) -> List[int]:
        w = int(sqrt(area))
        while area % w:
            w -= 1
        return [area // w, w]
相关推荐
元亓亓亓几秒前
LeetCode热题100--347. 前 K 个高频元素--中等
数据结构·算法·leetcode
一个无名的炼丹师2 分钟前
[硬核实战] 解锁多模态RAG:构建能“看懂”PDF复杂图表的智能问答系统
人工智能·python·pdf·多模态·rag
CoderYanger6 分钟前
贪心算法:2.将数组和减半的最少操作次数
java·算法·leetcode·贪心算法·1024程序员节
Chen--Xing9 分钟前
LeetCode 49.字母异位词分组
c++·python·算法·leetcode·rust
Dxy12393102169 分钟前
Python数据类型入门
python
孤独冷11 分钟前
ComfyUI 本地部署精华指南(Windows + CUDA)
windows·python
长安er12 分钟前
LeetCode 235 & 236 最近公共祖先(LCA)解题总结
算法·leetcode·二叉树·递归·lca
闲人编程14 分钟前
测试驱动开发与API测试:构建可靠的后端服务
驱动开发·python·flask·api·tdd·codecapsule
im_AMBER15 分钟前
Leetcode 77 数组中的最大数对和 | 统计坏数对的数目
笔记·学习·算法·leetcode
勇往直前plus20 分钟前
PyCharm 找不到包?Anaconda base 环境 pip 装到用户目录的排查与修复
ide·python·pycharm·conda·pip