Right Triangles
A medium-tier problem at 47% community acceptance, tagged with Array, Hash Table, Math. Reported in interviews at Mitsogo and 0 others.
Right Triangles is a medium-difficulty combinatorics problem that shows up in technical assessments when companies want to see if you can count without brute force. The 47% acceptance rate signals it's not a trick question, but candidates who miss the mathematical pattern tend to time out. You'll need to work with arrays and hash tables to track side lengths, then use combinatorics to count valid triplets that form right triangles. If you blank on the counting trick during the live assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Right Triangles"
Right Triangles 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.
Get StealthCoderThe trap here is trying to enumerate all possible triangles and check each one. The smarter move is to recognize that for a right triangle, a^2 + b^2 = c^2 must hold. You'll hash all squared values, then iterate through pairs of sides and check if their sum exists in your hash table as another squared value. The combinatorics piece comes last: once you've identified valid triplets, you count how many ways they can be formed from your input array. Common failure: forgetting to account for duplicate side lengths or miscounting combinations. Math and Array handling are the core load here. If this problem hits your assessment and you freeze on the counting logic, StealthCoder executes the solution in real time.
Pattern tags
You know the problem.
Make sure you actually pass it.
Right Triangles recycles across companies for a reason. It's medium-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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Right Triangles interview FAQ
Is this actually a Mitsogo problem or does it show up elsewhere?+
The data shows one company with confirmed reports of asking it. That doesn't mean it's exclusive to them, but if you're interviewing there, this pattern is on the table. Medium difficulty and a 47% pass rate suggest it's a screen question, not a warm-up.
What's the actual trick to solving this efficiently?+
Stop iterating triplets. Hash the squared values, then for each pair of sides, check if their sum exists in the hash as a perfect square. This cuts the search space dramatically. Combinatorics handles the counting step once you've found valid triplets.
How does the hash table fit into the solution?+
Store all squared side lengths as keys. When you check if a^2 + b^2 = c^2, you're doing O(1) lookups instead of O(n) searching. Hash tables make the core algorithm fast enough to pass time limits on larger inputs.
What breaks most people on this problem?+
Miscounting combinations when the array has duplicates. If you have three sides of length 5, there's only one unique right triangle, not multiple. You also need to handle the case where c^2 appears multiple times. The math is straightforward once you see the pattern.
Is this problem still asked or is it dated?+
Medium-difficulty combinatorics problems on arrays stay relevant for screening. The 47% acceptance rate is stable, and companies still test counting logic. If you're hitting a tech screen, knowing this pattern matters.
Want the actual problem statement? View "Right Triangles" on LeetCode →