Leetcode 2971. Find Polygon With the Largest Perimeter
Select a subset of at least three numbers from nums whose largest element is strictly less than the sum of the other chosen elements (polygon inequality) and maximize the subset sum; return that maximum perimeter or -1 if no valid polygon exists. This is typically solved by sorting and using a greedy strategy to discard overly large sides until the condition holds.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.