描述
给出三个整数 a, b, c, 如果它们可以构成三角形,返回 true.
- 三角形的定义 (Wikipedia)
样例
给定 a = 2, b = 3, c = 4
返回 true
给定 a = 1, b = 2, c = 3
返回 false
public class Solution {
/**
* @param a: a integer represent the length of one edge
* @param b: a integer represent the length of one edge
* @param c: a integer represent the length of one edge
* @return: whether three edges can form a triangle
*/
public boolean isValidTriangle(int a, int b, int c) {
// write your code here
if((a + b) <= c){
return false;
}
if((a+c) <= b){
return false;
}
if((b+c)<= a){
return false;
}
return true;
}
}