You are given an array of positive integers nums of length n.
A polygon is a closed plane figure that has at least 3 sides. The longest side of a polygon is smaller than the sum of its other sides.
Conversely, if you have k (k >= 3) positive real numbers a1, a2, a3, …, ak where a1 <= a2 <= a3 <= … <= ak and a1 + a2 + a3 + … + ak-1 > ak, then there always exists a polygon with k sides whose lengths are a1, a2, a3, …, ak.
The perimeter of a polygon is the sum of the lengths of its sides.