Description
Design a rectangular web page with area. Find length L and width W where L >= W, L * W = area, and L - W is minimized. Return [L, W].
Examples
Input:
area = 4Output:
[2,2]Explanation:
2×2=4.
Input:
area = 12Output:
[4,3]Explanation:
The factors of 12 are: (1,12), (2,6), (3,4). The differences L-W are 11, 4, and 1 respectively. The minimum difference is 1, so L=4 and W=3.
Input:
area = 1Output:
[1,1]Explanation:
For area=1, the only possible factorization is 1×1=1. Therefore L=1 and W=1, giving the minimum possible difference of L-W=0.
Constraints
- •
1 ≤ area ≤ 10⁷