Maximum Perimeter Triangle

  • + 2 comments

    My take on this, pretty similar to yours, I must say

    n = input()
    arr = sorted(map(int, str(raw_input()).split()))[::-1]
    
    try:
    	while (arr[1] + arr[2] <= arr[0]):
    		arr.remove(arr[0])
    	print arr[2],arr[1],arr[0]
    except:
    	print -1