Created
February 21, 2016 07:55
-
-
Save hxer/b86cff5c285761f23e51 to your computer and use it in GitHub Desktop.
判断两个集合是否有交集
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_intersection(a, b): | |
''' | |
input: | |
a = [1, 2, 3] | |
b = [3, 6, 9] | |
output: | |
True | |
''' | |
return any(_ in a for _ in b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment