Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Python Remove Duplicate Strings
00:00
5 left

Python Remove Duplicate Strings

EasyPython

Problem

Given a list of strings, identify and remove duplicate strings.

Implement def remove_duplicates(strings): and return a new list containing one copy of each string. Preserve the order of first occurrences and treat strings as case-sensitive, so "Virtusa" and "virtusa" are different values.

Constraints

  • 0 <= len(strings) <= 10^4
  • Each element of strings is a valid string
  • Preserve the order of first occurrences
  • String comparison is case-sensitive

Function Signature

def remove_duplicates(strings):
Interviewer

Your question is Python Remove Duplicate Strings. 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.