EASYasked at 1 company

Triangle Judgement

A easy-tier problem at 74% community acceptance, tagged with Database. Reported in interviews at Google and 0 others.

Founder's read

Triangle Judgement is a straightforward database problem that shows up in Google's technical assessments. You're given a table of triangle sides and need to determine which rows form valid triangles. It's easy, but the SQL logic trips people up if they don't nail the triangle inequality theorem on the first pass. The acceptance rate sits around 74 percent, which means most people pass it, but a meaningful chunk blank or over-engineer. If you hit this in a live OA and freeze on the WHERE clause logic, StealthCoder surfaces a working query in seconds, invisible to the proctor.

Companies asking
1
Difficulty
EASY
Acceptance
74%

Companies that ask "Triangle Judgement"

If this hits your live OA

Triangle Judgement 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 an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.

Get StealthCoder
What this means

The core logic is simple: three sides form a valid triangle only if the sum of any two sides is greater than the third. That translates to three conditions in your WHERE clause, all of which must be true. The trap is trying to be too clever with AND/OR syntax or forgetting that all three inequality checks are required, not just one. Most candidates either write it correctly on the first try or second-guess themselves and add unnecessary complexity. This is a pure database fundamentals check, and it's testing your comfort with basic SQL filtering. Since Google asks it, they're screening for people who can write clean, readable queries without overthinking. StealthCoder is your hedge if you blank on whether it's AND or OR between the conditions.

Pattern tags

The honest play

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

Triangle Judgement 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 an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Triangle Judgement interview FAQ

Is this problem actually asked at Google?+

Yes. The input data confirms Google has asked Triangle Judgement in their assessments. It's low-difficulty but real, and they use it to filter candidates who panic on basic database logic or can't translate a math rule into SQL cleanly.

What's the actual trick to Triangle Judgement?+

There's no trick. It's the triangle inequality theorem: a + b > c AND b + c > a AND a + c > b, all three conditions at once. The only trap is forgetting one of the three or using OR instead of AND. Write it straightforward and you'll pass.

How hard is this really if I know SQL basics?+

Very manageable. The 74 percent acceptance rate shows most people get through it. If you understand WHERE clause filtering and can apply three comparison operators, you're fine. The failure cases are usually syntax errors or logic mistakes, not algorithmic difficulty.

Do I need to optimize or index anything?+

No. This is a single-pass filter on a table. There's no join, aggregation, or window function required. Write a simple SELECT with a three-condition WHERE clause and you're done. Google isn't testing optimization here.

What database platform will they use in the OA?+

The input doesn't specify MySQL, PostgreSQL, or SQLite, but the syntax for basic comparisons and AND logic is identical across all of them. Write vanilla SQL and you'll be fine on whichever platform they use.

Want the actual problem statement? View "Triangle Judgement" 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.