Ad Accounts Sharing a Payment Method With a Banned Account
Last updated: November 29, 2026
Quick Overview
Find active Meta ad accounts that share any payment instrument fingerprint with an account banned for policy violations in the last 90 days, and return each risky account once with the number of banned accounts it is linked to.
Meta
November 29, 20260
0
0 solved
Find active Meta ad accounts that share any payment instrument fingerprint with an account banned for policy violations in the last 90 days, and return each risky account once with the number of banned accounts it is linked to.
Ads integrity at Meta links bad actors who come back on new accounts with the same card. The interviewer checks a bridge-table join, excluding the banned account itself, and deduping when accounts share several instruments.
What the Interviewer Expects
- Joins accounts to payment instruments through a bridge table
- Self joins the bridge on fingerprint to reach other accounts
- Excludes matching an account to itself
- Uses COUNT(DISTINCT banned_account) so multiple shared cards do not inflate
- Restricts to currently active accounts and recent bans
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you extend this to two hops (shared card, then shared device)?
- How do you avoid flagging accounts that share a corporate card legitimately?
- How would you turn the count into a risk score?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
ad_accounts(account_id, status, banned_at, ban_reason), account_payment(account_id, fingerprint), a many-to-many bridge since an account can have several cards and a card can be on several account...
Approach
- Banned set: accounts banned for policy in the last 90 days.
- Join banned accounts to their fingerprints, then join the bridge again on fingerprint to find other accounts with the same card.
- Ke...