You are viewing a single comment's thread. Return to all comments →
Here is my Python solution!
def maximumPerimeterTriangle(sticks): triangles = [] for i in range(len(sticks)): for j in range(i + 1, len(sticks)): for k in range(j + 1, len(sticks)): triangle = [sticks[i] ,sticks[j], sticks[k]] triangle.sort() if sum(triangle[:2]) > triangle[2]: triangles.append([sum(triangle), triangle]) if triangles: return sorted(triangles)[-1][1] return ["-1"]
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 →
Here is my Python solution!