Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Detect Duplicates in Player List
00:00
5 left

Detect Duplicates in Player List

EasyPython

Problem

FanDuel contest data may contain the same player more than once because of duplicated feed records or invalid lineup construction. Given a list of player records, return every duplicated player_id exactly once, ordered by the position where that ID is first detected as a duplicate.

Formal Specification

Implement find_duplicate_players(players), where players is a list of dictionaries. Each dictionary contains a hashable player_id, represented as an integer or string. Return a list of player IDs that occur at least twice. Each duplicate ID must appear once in the output.

A player ID is added to the result when its second occurrence is encountered. Do not mutate players.

Constraints

  • 0 <= len(players) <= 10^5
  • Every record contains exactly one player_id key
  • Each player_id is an integer or string and is hashable
  • Preserve input order and do not modify the input list

Function Signature

def find_duplicate_players(players):
Interviewer

Your question is Detect Duplicates in Player List. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.