Valid Triangle

http://www.lintcode.com/zh-cn/problem/valid-triangle/

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
        int sum = a + b + c;
        if (sum > a * 2 && sum > b * 2 && sum > c * 2) {
            return true;
        }
        return false;
    }
}

你可能感兴趣的:(Valid Triangle)