Given an array arr, ask if you can find 3 elements from the array as the sides of the three sides, so that the three sides can form a triangle. If yes, return yes, if not, return no
- 1 <= n<= 100000
- 1 <= arr[i] <= 1000000000
- The program will be run 500 times
Give arr=[2,3,5,8], return no.
Explanation: 2, 3, 5 cannot form a triangle 2, 3, 8 cannot form a triangle 3, 5, 8 cannot form a triangle So, return "no"
Give arr=[3,4,5,8] , return yes.
Explanation: 3, 4, 5 can form a triangle So return "yes"
Credits To: lintcode.com
Leave me comments, if you have better ways to solve.
// Blog link: https://code.dennyzhang.com/judging-triangle