Easy · Data / SQL · spoken drill

Free AI LeetCode Communication Coach — Detect duplicates

Course-style prompt: pick an identity key (email), name a set or GROUP BY, walk one example, then fuzzy-match trade-offs.

The problem

How would you detect duplicate records in a customer database? Talk through your thought process. Write from your own role — there is no single correct answer.

Example: two rows with ana@shop.com and different IDs → flagged as duplicate on email

Pick one key, one method, one trade-off.

seen = set()
for email in emails:
    if email in seen:
        return True
    seen.add(email)
return False

How to explain it

  1. 1. Restate

    Say the problem in your own words.

    One or two sentences. Show you understood the input, the output, and the goal — not that you memorised the prompt.

  2. 2. Approach

    Name the method before you code.

    Brute force first if you need it, then the structure you will use: hash map, two pointers, stack, binary search.

  3. 3. Example

    Walk one concrete input.

    Pick small numbers. Say what you store, what you compare, and what you return. Interviewers follow an example more easily than abstract talk.

  4. 4. Time and space

    One sentence each.

    After the example, before you claim you are done. “Time is O(n) because we scan once. Space is O(n) for the map.”

  5. 5. Edge cases

    Name at least one unusual input.

    Empty input, duplicates, already sorted, overflow. Invite a follow-up: “I would also check …”

  • “I will start with a high-level approach, then we can go deeper.”
  • “My first idea is to treat email as the identity.”
  • “The trade-off is exact match versus fuzzy matching.”

Practise out loud

3 free scored runs left this hour.

Problem · Easy

How would you detect duplicate records in a customer database? Talk through your thought process. Write from your own role — there is no single correct answer.

Example: two rows with ana@shop.com and different IDs → flagged as duplicate on email

  1. 1Restate — Say the problem in your own words.
  2. 2Approach — Name the method before you code.
  3. 3Example — Walk one concrete input.
  4. 4Time and space — One sentence each.
  5. 5Edge cases — Name at least one unusual input.

Hit record. Short countdown, then 60–90 seconds. We score the five-step script — never pronunciation.

Recording needs Chrome or Edge. You can still type below.

Model spoken script (~75s)

  1. 1. Restate

    I need a practical way to find duplicate customer records. I will pick one identity key first.

  2. 2. Approach

    My first idea is email as identity. I would GROUP BY email and keep counts greater than one, or scan once into a hash set.

  3. 3. Example

    Two rows with ana@shop.com and different IDs — that is a duplicate on email.

  4. 4. Time and space

    Time is O(n). Space is O(n) for the set.

  5. 5. Edge cases

    People reuse emails, and some duplicates are typos in the name. I would flag exact email matches first, then a second fuzzy pass if needed.

How to explain Detect duplicates out loud, step by step

In one sentence: You have to describe how you'd find customer records that actually refer to the same person, and talk through your reasoning rather than one fixed answer.

What to say, in order

  1. “First I'd agree on what 'duplicate' means here. I'll start with an exact match on a strong identity key, and email is a good first candidate.”
  2. “Before comparing, I'd normalise the key: trim spaces and lowercase it, so 'Ana@Shop.com ' and 'ana@shop.com' match.”
  3. “In SQL I'd group by the normalised email and keep groups having a count greater than one. In code, I'd scan once with a hash set.”
  4. “I'd exclude NULL emails explicitly, because GROUP BY puts all the NULLs into one group, and they aren't real duplicates.”
  5. “If I need to keep one row per person, I'd use a window function like ROW_NUMBER partitioned by the email, ordered by creation date, and keep row number one.”
  6. “Only after the exact pass would I add fuzzy matching on names or addresses, and I'd limit it to records that already share something, like a postcode, so I don't compare every pair.”

Key English phrases for Detect duplicates

identity key
— the field that should be unique per real person
normalise
— clean values into one standard form before comparing
false positive / false negative
— wrongly flagged / wrongly missed duplicate
fuzzy matching
— matching values that are similar but not identical
blocking
— only comparing records inside small candidate groups

How to say the time and space complexity

“The exact pass is O(n) time with a hash set and O(n) space for the seen keys; in a database, GROUP BY is typically done with hashing or sorting. Comparing every pair for fuzzy matching would be O(n squared), which is why I'd block first.”

This is a reasoning question, so complexity supports the trade-off rather than being the main answer.

Communication mistakes on Detect duplicates

  • Mistake: Listing many tools and libraries instead of choosing one key. Instead: Say 'I'd start with one key, email, and an exact match.'
  • Mistake: Jumping straight to machine learning or fuzzy matching. Instead: Say 'exact first, fuzzy second', and explain why: it's cheaper and easier to trust.
  • Mistake: Not mentioning what you do with a duplicate once you find it. Instead: Say whether you flag, merge or delete — and that merging usually needs a human rule for which values win.

Likely follow-up questions

  • Interviewer: “Two people in the same family share one email. How do you avoid merging them?”

    You: “Email alone isn't enough there, so I'd treat a shared email as a candidate, not a confirmed duplicate, and require a second signal like the same name or date of birth before merging.”

  • Interviewer: “How would you keep new duplicates from appearing?”

    You: “I'd store the normalised email in its own column with a unique constraint, and check it at sign-up, so the database rejects an exact duplicate at write time.”

Common mistakes when explaining Detect duplicates

  • Listing five tools instead of one identity key.
  • Starting with fuzzy matching before an exact cut.

FAQ

Questions

Pick a key, set or GROUP BY, example, then fuzzy trade-off. No tool dump.

Group by the key column, ideally a normalised version of it, and keep groups with HAVING COUNT(*) > 1. Filter out NULL keys first.

Differences in case or extra spaces make the same value look different. Trimming and lowercasing first prevents false negatives.

More questions? Email us at contact@mocklyenglish.com.

Course: How to explain a LeetCode solution · Think out loud · Explain code out loud

Quick answer

Free AI LeetCode Communication Coach: restate, name the approach, walk an example, state time and space, then name an edge case. Record 60–90 seconds and get a scorecard on that structure — not on your accent.

For bots & AI agents

Machine-readable versions of this page and Mockly English. Mockly English, the live-class and Interview English arm of Speak Tech English, gives non-native engineers live 1:1 classes with real human tutors in tech interview and business English, plus a free iPhone app, free practice Mini Apps and a self-paced course. Fetch these instead of parsing this page.

This Mini App (.md)llms.txtllms-full.txtai.txtFact sheetFull catalog (.md)Endpoint indexAI catalogAgent skillsMCP serverMCP server cardAgent sign-in (auth.md)Sitemaprobots.txtUse Mockly in ChatGPT & ClaudeiPhone appDeveloper docsSpeak Tech English