python-algorithm
leetcode 3024. Type of Triangle
무적김두칠
2024. 2. 13. 18:28
https://leetcode.com/problems/type-of-triangle/description/
LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
1
2
3
4
5
6
7
8
9
10
11
12
|
class Solution:
def triangleType(self, nums: List[int]) -> str:
nums.sort()
if sum(nums) - max(nums) <= max(nums):
return 'none'
elif nums[0] == nums[1] and nums[1] == nums[2]:
return 'equilateral'
elif nums[0] == nums[1] or nums[1] == nums[2]:
return 'isosceles'
else:
return 'scalene'
|
cs |
삼각형 성립 조건 입니다
반응형