✅ Easy to understand || ✅0ms || 100% beats🔥|| Php
IntuitionThe problem requires identifying the type of triangle based on the given side lengths.
First, we need to check if the sides can form a valid triangle u
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem requires identifying the type of triangle based on the given side lengths.  
First, we need to check if the sides can form a valid triangle using the **triangle inequality theorem**:
- `side1 + side2 > side3`
- `side1 + side3 > side2`
- `side2 + side3 > side1`  

If the sides form a valid triangle, we classify it into one of the following types:
- **Equilateral**: All sides are equal.
- **Isosceles**: Two sides are equal.
- **Scalene**: All sides are different.  
If the sides do not satisfy the triangle inequality, it is labeled as **"none"**.

# Approach
<!-- Describe your approach to solving the problem. -->
1. **Sort the array** → Sorting makes it easier to check the inequality condition with the largest side at the end.  
2. **Triangle inequality check** → If the sum of the two smaller sides is less than or equal to the largest side, it cannot form a triangle, so return **"none"**.  
3. **Triangle type check**:  
   - If all sides are equal → Return **"equilateral"**.  
   - If two sides are equal → Return **"isosceles"**.  
   - If all sides are different → Return **"scalene"**.  

# Complexity
- **Time complexity:**  
  - $$O(n \log n)$$ → Due to sorting the sides.  
- **Space complexity:**  
  - $$O(1)$$ → No extra space is used, only variables for the sides.

# Code
```php
class Solution {

    /**
     * @param Integer[] $nums
     * @return String
     */
    function triangleType($nums) {
        sort($nums);
        
        // Triangle inequality check
        if ($nums[0] + $nums[1] <= $nums[2])    
            return "none";
        
        // Check triangle type
        if ($nums[0] == $nums[1] && $nums[1] == $nums[2])   
            return "equilateral";
        elseif ($nums[0] == $nums[1] || $nums[1] == $nums[2] || $nums[0] == $nums[2])   
            return "isosceles";
        else  
            return "scalene";
    }
}
```

['PHP']