Easy
Type of Triangle II — Python
Full explanation · Time O(1) · Space O(1)
# Time: O(1)
# Space: O(1)
# math
class Solution(object):
def triangleType(self, nums):
"""
:type nums: List[int]
:rtype: str
"""
nums.sort()
a, b, c = nums
if a+b <= c:
return "none"
if a == b == c:
return "equilateral"
if a == b or b == c:
return "isosceles"
return "scalene"