Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Group Similar Call Transcripts

MediumPython00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the Python screen.

The question is on your right: Group Similar Call Transcripts. Read through the requirements first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

You need to log in / sign up to run or submit.

Problem

Assort Health wants to deduplicate short call transcript snippets before downstream review. Given a list of lowercase strings, group together all strings that are anagrams of each other and return the groups.

Two strings belong in the same group if they contain exactly the same characters with the same frequencies, regardless of order. Implement an algorithm that efficiently groups all such strings.

Formal Specification

  • Input: transcripts, a list of lowercase strings
  • Output: A list of groups, where each group is a list of strings that are anagrams of one another
  • Strings may be returned in any order, and groups may be returned in any order

Constraints

  • 1 <= len(transcripts) <= 10^4
  • 0 <= len(transcripts[i]) <= 100
  • transcripts[i] contains only lowercase English letters

Function Signature

def group_anagram_transcripts(transcripts):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output