Last active
August 29, 2015 14:01
-
-
Save nsfyn55/607229f64f16c042693a to your computer and use it in GitHub Desktop.
Find curved numbers interview question
This file contains hidden or 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
s = set(['0','2','3','5','6','8','9']) | |
l = ['33', '14', '19'] | |
# as loop | |
for num in l: | |
charset = set(num) | |
if charset.intersection(s): | |
print num | |
# as comprehension | |
result = [num for num in l if set(num).intersection(s)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment