EASYasked at 2 companies

Count Good Triplets

A easy-tier problem at 85% community acceptance, tagged with Array, Enumeration. Reported in interviews at Turvo and 1 others.

Founder's read

Count Good Triplets is an easy brute-force problem that shows up in screening rounds at Bloomberg and Turvo. The acceptance rate is high because the pattern is simple: iterate through all possible triplets and count those matching a condition. The gotcha isn't the algorithm, it's recognizing when to stop overthinking and just enumerate. If you blank on whether to use nested loops or a smarter approach, StealthCoder delivers a working solution instantly during your live assessment, invisible to the proctor.

Companies asking
2
Difficulty
EASY
Acceptance
85%

Companies that ask "Count Good Triplets"

If this hits your live OA

Count Good Triplets 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 Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

This problem lives in the enumeration bucket. You're given an array and constraints, and you need to count triplets where each element pair satisfies distance and value rules. The brute-force approach is three nested loops: iterate i, j, k and check the conditions. Most candidates overthink it, reaching for hash maps or sorting. The reality: on an easy-level array (small n), enumeration is fast enough and clearer than premature optimization. The common trap is off-by-one errors in loop bounds or misreading the distance constraint. During a live OA, if you freeze on the exact condition logic, StealthCoder renders a clean triple-loop solution in seconds, letting you move on.

Pattern tags

The honest play

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

Count Good Triplets 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 Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Good Triplets interview FAQ

Is the brute-force triple-loop solution really acceptable?+

Yes. This is an easy problem with high acceptance. The constraint is typically small (n less than 250 or so), making O(n^3) feasible. Bloomberg and Turvo both ask it; neither expects DP or advanced structures. Enumeration is the intended path.

What's the most common mistake in the condition check?+

Mixing up the distance constraint. The condition usually involves abs(arr[i] - arr[j]), abs(arr[j] - arr[k]), and abs(arr[i] - arr[k]). Candidates often forget the third pair or apply operators wrong. Read the problem statement twice before coding.

Should I worry about time complexity for a Bloomberg screening?+

Not for this problem. At the easy level with a 85% acceptance rate, Bloomberg is screening for correctness and clarity, not optimization tricks. A clean, correct brute-force beats a buggy attempt at optimization every time.

Does this problem test anything beyond loops?+

Mostly no. It's a pure enumeration problem with basic conditionals. The learning value is recognizing when brute-force is the right tool and reading problem constraints precisely. Arrays and Enumeration are your two topics.

Why is the acceptance rate so high?+

Because enumeration is straightforward once you parse the condition. No hidden algorithmic trick, no graph conversion, no dynamic programming. If you understand loops and boolean logic, you can solve it. That's why it screens for attention to detail, not brilliance.

Want the actual problem statement? View "Count Good Triplets" 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.