MEDIUMasked at 1 company

Number of Trusted Contacts of a Customer

A medium-tier problem at 75% community acceptance, tagged with Database. Reported in interviews at Roblox and 0 others.

Founder's read

This is a SQL problem that looks simple until you realize the join logic will break on you. You're given customer and contact tables, and you need to count how many contacts are marked as trusted. Roblox has asked this, and at 75% acceptance rate, most people who attempt it get it right, but that often means they've already hit the gotcha once. The trick isn't the counting. It's handling customers with zero trusted contacts correctly, and making sure your join doesn't accidentally inflate the count. If you blank on the edge case during your assessment, StealthCoder will surface the working query in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
75%

Companies that ask "Number of Trusted Contacts of a Customer"

If this hits your live OA

Number of Trusted Contacts of a Customer 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The obvious approach is an inner join from customers to contacts, filter for trusted, then count and group by customer ID. That works until you realize customers with no trusted contacts disappear from the result set entirely. You need a left join to keep all customers, then use COUNT(contact_id) only on the trusted rows to avoid nulls inflating counts. The real trap is mixing aggregation logic with join direction. Some candidates do an inner join correctly but forget to handle the IS TRUSTED condition in the WHERE clause instead of the join predicate, which changes the result again. Database questions test your mental model of how joins preserve versus filter rows. This problem forces you to think through that. If you're unsure about your join structure when you see this live, StealthCoder lets you verify the solution without the panic.

Pattern tags

The honest play

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

Number of Trusted Contacts of a Customer 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Number of Trusted Contacts of a Customer interview FAQ

Is this really a medium problem?+

Yes, by acceptance rate. But 75% passes because most people get the join and aggregation right after they think about it. The difficulty is catching your first instinct being wrong, not the solution itself. You'll spot the issue in a mock, but under time pressure in an OA, the edge case can cost you five minutes.

What's the key difference between this and a simple count query?+

The key is that you must include customers with zero trusted contacts in the output, and with zero as the count. An inner join drops them. A left join keeps them, but then your COUNT() has to be careful to count only non-null values, not NULL rows from the join.

Does Roblox ask this in their actual interview loop?+

Roblox is in the data. Database questions are common in backend and data roles, especially for companies building multiplayer platforms. If you're interviewing there, expect SQL. This problem's difficulty and acceptance rate suggest it's a real screener, not trivial.

What topics should I review before I see this live?+

Focus on Database. Know the difference between inner join, left join, and right join behavior. Understand how NULL values behave in aggregate functions like COUNT(). Practice writing queries that preserve rows from one table while filtering from another.

How do I know if my query is right?+

Test with a customer who has no trusted contacts. Your query must return that customer with a count of 0, not omit them entirely. If your result set size changes when you add or remove the trust filter, your join logic is wrong. Verify manually on small datasets first.

Want the actual problem statement? View "Number of Trusted Contacts of a Customer" 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.