FunctionRacerProblemsRace

Type of Triangle

BeginnerMathPython, JavaScript, TypeScript, Java, C++

sides has three positive lengths. If they cannot form a triangle with positive area (the longest side is at least as long as the other two added together), return "none". Otherwise return "equilateral" if all three sides are equal, "isosceles" if exactly two are equal, and "scalene" if all are different.

Example 1

sides [3,4,5]
returns "scalene"

All different: "scalene".

Example 2

sides [1,2,3]
returns "none"

1 + 2 is not more than 3: "none".

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems