You are viewing a single comment's thread. Return to all comments →
Mine solutions:
from itertools import combinations def maximumPerimeterTriangle(sticks): # Write your code here # bruteforce way ls=list(filter(lambda x:x[0]+x[1]>x[2] and x[0]+x[2]>x[1] and x[1]+x[2]>x[0],list(combinations(sorted(sticks), 3)))) ls_s=tuple(map(lambda x:(x, sum(x)), ls)) return [-1] if not ls_s else list(max(ls_s)[0])
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 →
Mine solutions: