Problem Statement  
The perimeter of a triangle with edge lengths a, b and c is a + b + c. You have several sticks of various lengths. The int[] lengths contains the length of each stick. Return the maximum possible perimeter of a triangle that can be constructed with your sticks. Each edge of the triangle must be constructed using exactly one stick. You are not allowed to break sticks into smaller pieces. Return 1 if no triangle can be constructed.  
Definition  
 
Notes  
  You can construct a triangle with edge lengths x <= y <= z if and only if x + y > z.  
Constraints  
  lengths will contain between 3 and 50 elements, inclusive.  
  Each element of lengths will be between 1 and 1000, inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
 
5)  
