Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Duplicate Check Function
00:00
5 left

Duplicate Check Function

EasyPython

Problem

Write a function that checks for duplicate entries in a list.

Implement contains_duplicate(entries), which returns True if any value appears more than once and False otherwise. Assume all entries are hashable, and preserve no ordering because only the existence of a duplicate matters.

Function signature: def contains_duplicate(entries):

Input is a list of hashable values. The output is a Boolean.

Constraints

  • 0 <= len(entries) <= 10^4
  • Every entry is hashable
  • Return a Boolean value

Function Signature

def contains_duplicate(entries):
Interviewer

Your question is Duplicate Check Function. 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
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.