2025-08-22 15:43:10 +0000 UTC

Type of Triangle

Code

class Solution:
    def triangleType(self, nums: List[int]) -> str:
        s1, s2, s3 = nums
        if s1 == s2 == s3:
            return "equilateral"
        if s1 + s2 <= s3 or s1 + s3 <= s2 or s2 + s3 <= s1:
            return "none"
        if s1 == s2 or s2 == s3 or s1 == s3:
            return "isosceles"
        if s1 != s2 and s2 != s3 and s1 != s3:
            return "scalene"
        return "none"