Type Of Triangle 2
Intuition\n Describe your first thoughts on how to solve this problem. \nThe code checks whether the given lengths of sides form a valid triangle or not by veri
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe code checks whether the given lengths of sides form a valid triangle or not by verifying the triangle inequality theorem. Then, it further checks for the type of triangle based on the equality of sides.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe code first checks if the given lengths can form a triangle or not. If they do, it proceeds to check the type of triangle based on the lengths of its sides. It considers three cases: scalene (no sides are equal), equilateral (all sides are equal), and isosceles (two sides are equal).\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nThe time complexity of this code is O(1) because it performs a constant number of comparisons and operations regardless of the size of the input array (which is always of size 3).\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nThe space complexity of this code is also O(1) because it uses a constant amount of extra space. The space used does not grow with the size of the input array.\n# Code\n```\nclass Solution {\n    public String triangleType(int[] nums) {\n        if(nums[0] + nums[1] > nums[2] && nums[1] + nums[2] > nums[0] && nums[2] + nums[0] > nums[1]){\n            if (nums[0]!=nums[1] && nums[1]!=nums[2] && nums[0]!=nums[2]){\n                return "scalene";\n            }else if(nums[0]==nums[1] && nums[1] == nums[2]){ \n                return "equilateral";\n            }else{\n                return "isosceles";\n            }\n        }else{\n            return "none";\n        }\n    }\n}\n```
['Java']