Group Duplicate Support Tickets by Normalized Message Fingerprint

Last updated: November 29, 2026

Quick Overview

Given a list of (ticket_id, text) pairs from a customer's support inbox, group tickets whose text is identical after lowercasing and stripping punctuation and extra whitespace. Return only groups with two or more tickets, ordered by first appearance.

Sierra
Coding & Algorithms
Software Engineer
Sierra
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of (ticket_id, text) pairs from a customer's support inbox, group tickets whose text is identical after lowercasing and stripping punctuation and extra whitespace. Return only groups with two or more tickets, ordered by first appearance.

Sierra agents ingest historical tickets from a customer's helpdesk to learn common intents, and duplicates skew that analysis. This warm-up checks that you can pick a clean canonical key, use a hash map correctly, and keep output deterministic.

What the Interviewer Expects
  • Define the normalization rule explicitly before coding
  • Use a dictionary keyed by the normalized string
  • Preserve first-appearance order of groups and of ids inside a group
  • Run in O(total characters) time
  • Discuss what normalization misses (typos, reordered words)
Key Topics to Cover
hash maps
string normalization
grouping
deterministic ordering
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you treat 'order #123' and 'order #456' as the same intent?
  • How would you catch near duplicates with small typos at scale?
  • What changes if tickets stream in and you must flag a duplicate on arrival?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is a list of (ticket_id, text). Two tickets are duplicates when their text matches after: lowercasing, dropping every character that is not a letter or digit, and collapsing whitespace. Output...

High-Level Design

Compute a fingerprint per ticket by extracting alphanumeric tokens and joining them with single spaces. Bucket ids under that fingerprint in a dictionary, and keep a separate list of fingerprints in t...


Submit Your Answer
Markdown supported

Related Questions