public class Solution {
public int[] ConstructRectangle(int area)
{
Dictionary<int, int> dic = new Dictionary<int, int>(); for (int i = ; i <= area; i++)
{
var W = i;
var L = Convert.ToInt32(area / i); if (L >= W && W * L == area)
{
dic.Add(L, W);
}
} var d = dic.LastOrDefault();
var ary = new int[] { d.Key, d.Value };
Console.WriteLine("L=" + ary[] + ",W=" + ary[]);
return ary;
}
}
https://leetcode.com/problems/construct-the-rectangle/#/description