Valid Triangle
Given an array sides containing exactly three integers, return true when the values can be the side lengths of a triangle and false otherwise. Every side must…
Given an array `sides` containing exactly three integers, return `true` when the values can be the side lengths of a triangle and `false` otherwise. Every side must be positive, and the sum of each pair of sides must be strictly greater than the remaining side. Equality is a degenerate triangle and returns `false`.
- `sides.length = 3` - `-1000 <= sides[i] <= 1000` - Each value is one exact integer; booleans and non-integer values are invalid.
Example 1: input sides = [3, 4, 5]; output true. All three sides are positive and every pair sum is greater than the remaining side.
Example 2: input sides = [1, 2, 3]; output false. The sum of the first two sides equals the third side, so the triangle is degenerate.
Example 3: input sides = [0, 4, 5]; output false. A triangle side length must be positive.
Category: Math & Numbers. Topic: math. Difficulty: Easy. Patterns: math.