Beats 100% | Using Triangle Inequality Theorem
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {number[]} nums
 * @return {string}
 */
var triangleType = function(nums) {
  let a = nums[0], b = nums[1], c = nums[2];

  // Check for valid triangle using triangle inequality theorem
  if (a + b > c && a + c > b && b + c > a) {
    // Check if all sides are equal
    if (a === b && b === c) {
      return "equilateral";  // All sides are equal
    }
    // Check if two sides are equal
    else if (a === b || b === c || a === c) {
      return "isosceles";  // Two sides are equal
    }
    // If no sides are equal
    else {
      return "scalene";  // All sides are different
    }
  }
  
  // If triangle inequality is not satisfied
  return "none";  // Not a valid triangle
};

```
['JavaScript']