You are viewing a single comment's thread. Return to all comments →
c#
public static List maximumPerimeterTriangle(List sticks)
{ List<int> sides = new List<int>(); sticks.Sort(); sticks.Reverse(); while (sticks.Count > 2) { if (sticks[0] < (sticks[1] + sticks[2])) { sides.Add(sticks[2]); sides.Add(sticks[1]); sides.Add(sticks[0]); return sides; break; } else sticks.Remove(sticks[0]); } sides.Add(-1); return sides; }
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Perimeter Triangle
You are viewing a single comment's thread. Return to all comments →
c#
public static List maximumPerimeterTriangle(List sticks)