0 day streak
Anonymous · shared experience20 Apr 2026 · 5 views

Affirm: Fraud detector that spreads suspicion through shared personal details

Interview question #Affirm DSA / coding

Problem. A stream of events arrives. Underwriting events carry personal details such as address, phone, email and SSN. Fraud-flag events mark details as fraudulent. For each underwriting event, return "1" if it is suspicious and "0" otherwise; return an empty string for fraud-flag events. An underwriting event is suspicious if any of its details has already appeared in a flagged or suspicious event, and a suspicious event's details then become suspicious too.

Warm-up in the same round. Before this, the candidate fixed a buggy counter of distinct personal details across underwriting events. It counted other event types, skipped the SSN field and counted missing fields as empty strings.

Constraints given. Each method must run in at most O(log n) time, where n is the number of events seen.

Approach. Keep a hash set of suspicious detail values. For each underwriting event, check its non-empty details against the set; if any match, add all its details to the set and return "1".

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.