From d5429e9e226a6ad9c843b6815d3ff5ca94aa1497 Mon Sep 17 00:00:00 2001 From: bumpsoo Date: Mon, 19 May 2025 22:15:24 +0900 Subject: [PATCH] Add easy/type_of_triangle.py --- easy/type_of_triangle.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 easy/type_of_triangle.py diff --git a/easy/type_of_triangle.py b/easy/type_of_triangle.py new file mode 100644 index 0000000..6805c9b --- /dev/null +++ b/easy/type_of_triangle.py @@ -0,0 +1,16 @@ +# https://leetcode.com/problems/type-of-triangle + +from typing import List + +class Solution: + def triangleType(self, nums: List[int]) -> str: + [a, b, c] = nums + if a == b == c: + return "equilateral" + s = a + b + c + m = max(nums) + if s - m <= m: + return "none" + if a == b or b == c or a == c: + return "isosceles" + return "scalene" \ No newline at end of file