leetcode_492. Construct the Rectangle ? 待解决
来源:互联网 发布:c语言主函数的格式 编辑:程序博客网 时间:2024/06/05 20:58
For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:
The area of the rectangular web page you designed must equal to the given target area.
The width W should not be larger than the length L, which means L >= W.
The difference between length L and width W should be as small as possible.
You need to output the length L and the width W of the web page you designed in sequence.
Example:
Input: 4
Output: [2, 2]
Explanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1].
But according to requirement 2, [1,4] is illegal; according to requirement 3, [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.
Note:
The given area won’t exceed 10,000,000 and is a positive integer
The web page’s width and length you designed must be positive integers.
提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢
历史题目和总结见公众号「每日一道算法题」
https://leetcode.com/problems/construct-the-rectangle/description/
思路:
- leetcode_492. Construct the Rectangle ? 待解决
- LeetCode_492. Construct the Rectangle
- leetcode[Construct the Rectangle]//待整理多种解法
- LEETCODE--Construct the Rectangle
- Construct the Rectangle
- leetcode492: Construct the Rectangle
- 492. Construct the Rectangle
- 【leetcode】Construct the Rectangle
- 492. Construct the Rectangle
- LeetCode:Construct the Rectangle
- 492. Construct the Rectangle
- 492. Construct the Rectangle
- 492. Construct the Rectangle
- LeetCode Construct the Rectangle
- Construct the Rectangle
- 492. Construct the Rectangle
- Construct the Rectangle
- Construct the Rectangle
- 1027. 打印沙漏(20)
- 智能投顾 线下沙龙笔记
- 0-1背包问题
- Java基础知识(上)
- Android Studio 3.1 Preview DexArchiveBuilderException
- leetcode_492. Construct the Rectangle ? 待解决
- 2015年读书总结
- 由盛而衰的O2O,在明年还能笑傲江湖吗?
- Spring定时任务的几种实现(转)
- PMCAFF产品经理第一课 | 深圳站 现场集锦
- 给定一颗二叉搜索树,请找出其中的第k大的结点。例如, 5 / \ 3 7 /\ /\ 2 4 6 8 中,按结点数值大小顺序第三个结点的值为4。
- map转化为list
- PMCAFF原创文章人气周榜第三期(原创干货由你评鉴,在评论里写下你的看法吧~)
- 分布式系统笔记:利用zookeeper实现分布式任务锁(Java)