3024. Type of Triangle ¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7 8 9 10 11 12 13class Solution { public: string triangleType(vector<int>& nums) { ranges::sort(nums); if (nums[0] + nums[1] <= nums[2]) return "none"; if (nums[0] == nums[1] && nums[1] == nums[2]) return "equilateral"; if (nums[0] == nums[1] || nums[1] == nums[2]) return "isosceles"; return "scalene"; } }; 1 2 3 4 5 6 7 8 9 10 11 12class Solution { public String triangleType(int[] nums) { Arrays.sort(nums); if (nums[0] + nums[1] <= nums[2]) return "none"; if (nums[0] == nums[1] && nums[1] == nums[2]) return "equilateral"; if (nums[0] == nums[1] || nums[1] == nums[2]) return "isosceles"; return "scalene"; } } 1 2 3 4 5 6 7 8 9 10class Solution: def triangleType(self, nums: list[int]) -> str: nums.sort() if nums[0] + nums[1] <= nums[2]: return 'none' if nums[0] == nums[1] and nums[1] == nums[2]: return 'equilateral' if nums[0] == nums[1] or nums[1] == nums[2]: return 'isosceles' return 'scalene'