Tap here to switch tabs
Problem
Submissions

Problem: Type of Triangle

med
30 min
Try to solve the Type of Triangle problem.

Statement

You are given an integer array nums of length 33, where each element represents the length of a side. Determine what kind of triangle these three sides form and return the corresponding string.

Return:

  • "equilateral" if all three sides are equal

  • "isosceles" if exactly two sides are equal

  • "scalene" if all three sides are different

  • "none" if the three sides cannot form a valid triangle

A set of side lengths forms a valid triangle if the sum of any two sides is strictly greater than the remaining side.

Note: A triangle is valid only when all three pairwise triangle inequalities hold.

Constraints:

  • nums.length == 3

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Type of Triangle

med
30 min
Try to solve the Type of Triangle problem.

Statement

You are given an integer array nums of length 33, where each element represents the length of a side. Determine what kind of triangle these three sides form and return the corresponding string.

Return:

  • "equilateral" if all three sides are equal

  • "isosceles" if exactly two sides are equal

  • "scalene" if all three sides are different

  • "none" if the three sides cannot form a valid triangle

A set of side lengths forms a valid triangle if the sum of any two sides is strictly greater than the remaining side.

Note: A triangle is valid only when all three pairwise triangle inequalities hold.

Constraints:

  • nums.length == 3

  • 1≤1 \leq nums[i] ≤100\leq 100