What would be the time complexity (General/Worst case) of the following lines of code?
s1 = "any-string-of-large-size"
s2 = "anyother-string-of-larger-size"
if(any(x in s1 for x in s2)):
return "YES"
return "NO"
This code is for checking if there is any letter common to s1 and s2. I would also like to have any other approach to achieve this which may be more efficient.
I find it difficult to calculate time complexities when using such library functions. Can someone also please explain how to calculate it