educative.io

If the second list has duplicate elements

Hi Team,
in list as a subset problem, if second list has duplicate element will the approach using sets work?

e.g. list 1- list1 = [9, 4, 7, 1, -2, 6, 5]
list 2- list2 = [7, 1,1, -2]


Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers

Hi Apoorw_Anand,
This solution is specially designed for sets with unique characters as mentioned in the Challenge 1: A List as a Subset of Another List - Data Structures for Coding Interviews in Python lesson.
Yeah, it returns true if the second list has duplicate elements, but technically it’s not the subset of the first, according to your example.