Trains the technique from
LeetCode 3024Type of TriangleThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Three rod lengths are given as rods.
Return the name of the triangle they form:
"none" when they cannot form a triangle at all, which happens exactly when some two of them added together do not exceed the third;"equilateral" when all three are the same length;"isosceles" when exactly two are the same length;"scalene" when no two are the same length.Example 1
Two and two added together exceed three, so a triangle is possible, and exactly two of the rods are the same length.
Example 2
The two short rods add to two, which does not exceed five, so they cannot close into a triangle at all.
Example 3
Six and seven exceed eight, so a triangle is possible, and no two rods are the same length.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def triangle_type(rods: list[int]) -> str:public String triangleType(int[] rods)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.