EASYasked at 1 company

Type of Triangle

A easy-tier problem at 45% community acceptance, tagged with Array, Math, Sorting. Reported in interviews at IBM and 0 others.

Founder's read

Type of Triangle is a classification problem that looks trivial but trips up candidates who skip the preconditions. You're given three sides and need to return what kind of triangle they form: equilateral, isosceles, scalene, or invalid. IBM asks this. The 44% acceptance rate should tell you something: most people either misunderstand the validity check or forget to sort before applying the triangle inequality. It's easy to feel confident on this one and wrong in the assessment.

Companies asking
1
Difficulty
EASY
Acceptance
45%

Companies that ask "Type of Triangle"

If this hits your live OA

Type of Triangle is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The trap is that you can't just check side equality and call it done. You first have to verify the three sides actually form a valid triangle using the triangle inequality theorem: the sum of any two sides must be strictly greater than the third. Sort the array first so you only need one check: sides[0] + sides[1] > sides[2]. Only after validation do you classify by equality. Most rejections happen because candidates skip validation or apply it after classification logic, wasting time on edge cases that should fail instantly. If you blank on the inequality check during a live assessment, StealthCoder surfaces the full validation flow in seconds, invisible to the proctor, so you don't burn 10 minutes chasing a logic bug.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Type of Triangle recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Type of Triangle interview FAQ

What's the triangle inequality and why do so many people forget it?+

The sum of any two sides must be strictly greater than the third. Most candidates assume all three integers just form a triangle and skip this check. That's why acceptance is only 44%. Sort first, then check sides[0] + sides[1] > sides[2]. That's the gate.

Does the order of the input sides matter?+

Not if you sort. Sorting the three sides takes one line and makes validation bulletproof. Without it, you'd need to check all three combinations. Sort first, check once, classify by equality. Efficiency and correctness both win.

Is this still asked at real companies?+

IBM has reported it. It's simple enough to appear in early-stage assessments or as a warm-up. Don't skip it thinking it's a gimme. The low acceptance rate suggests candidates underestimate the validity logic. Get it right.

What topics do I actually need to solve this?+

Array (to store three sides), Sorting (to order them for the inequality check), and Math (the triangle inequality theorem itself). All three are straightforward, but the Math logic is the linchpin. Mess that up and your classification is junk.

What's the most common way people fail this?+

Forgetting the validity check entirely or doing it after classification. A candidate might classify [1, 2, 10] as scalene because all sides differ, never checking that 1 + 2 > 10 is false. Always validate first, classify second.

Want the actual problem statement? View "Type of Triangle" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.