3024. Type of Triangle
IntuitionWhen you want to determine the type of triangle from three given side lengths, the first thing is to check if the sides can even form a triangle. If th
# Intuition
When you want to determine the type of triangle from three given side lengths, the first thing is to check if the sides can even form a triangle. If they can, the type of triangle (equilateral, isosceles, or scalene) depends on whether the side lengths are equal or not.
# Approach

Validation:
To form a valid triangle, the sum of any two sides must be greater than the third side. This is checked using the validateTriangle function.

Triangle Type:

If all three sides are equal, it's an equilateral triangle.
If two sides are equal, it's an isosceles triangle.
If all three sides are different, it's a scalene triangle.
Invalid Case:
If the sides don’t satisfy the triangle condition, return "none".

# Complexity
- Time complexity:
Since the code only performs a few simple comparisons, the time complexity is 
𝑂(1)

- Space complexity:
𝑂(1)

# Code
```cpp []
class Solution {
    bool validateTriangle(vector<int>& nums){
        int count = 0;
        if(nums[0] + nums[1] > nums[2]){
            count++;
        }
        if(nums[1] + nums[2] > nums[0]){
            count++;
        }
        if(nums[2] + nums[0] > nums[1]){
            count++;
        }


        if(count == 3) return true;
        return false;
    }
public:
    string triangleType(vector<int>& nums) {
        bool answer = validateTriangle(nums);
        if(answer == true){
            if(nums[0] == nums[1]  && nums[0] == nums[2]) return "equilateral";
            else if(nums[0] == nums[1]  ||  nums[0] == nums[2] || nums[1] == nums[2]){
                return "isosceles";
            }
            else if(nums[0] != nums[1]  &&  nums[0] != nums[2] && nums[1] != nums[2]){
        }   return "scalene";
    }
       return "none";
    }
};
```
['C++']