Short Code || HashSet || 1ms 🔥🔥|| Please upvote
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem appears to involve determining the type of triangle based on its side lengt
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem appears to involve determining the type of triangle based on its side lengths. The code seems to check the validity of a triangle using the triangle inequality theorem and then identifies the type (equilateral, isosceles, or scalene) based on the count of unique side lengths.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTriangle Inequality Check: The code checks whether the given side lengths satisfy the triangle inequality theorem, which states that the sum of the lengths of any two sides of a triangle must be greater than the length of the third side.\n\nType Identification: After the triangle inequality check, the code uses a HashSet to count the unique side lengths. Based on the count, it identifies whether the triangle is equilateral, isosceles, or scalene.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n# Code\n```\nclass Solution {\n    public String triangleType(int[] nums) {\n        int a=nums[0];\n        int b=nums[1];\n        int c=nums[2];\n        // checking validity of Triangle\n        if(a + b <= c || b + c <= a ||  a + c <= b){\n            return "none";\n        }\n\n        // Checking Type of Triangle\n        HashSet<Integer> num = new HashSet<>();\n        for (int n: nums) num.add(n);\n        if(num.size()==1) return "equilateral";\n        else if (num.size()==2) return "isosceles";\n        else return "scalene";\n    }\n}\n```
['Hash Table', 'Java']