Sometimes we encounter the problem of checking if one list contains any element of another list. This kind of problems is quite popular in competitive programming. Let’s discuss various ways to achieve this particular task.
Method #1: Using
Method #2: Using in operator.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.