Created
May 29, 2017 19:17
-
-
Save zeapo/2229fddf79d6ed912c4f223eec7d9733 to your computer and use it in GitHub Desktop.
null created by zeapo - https://repl.it/IW9F/0
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 fn(arr): | |
target = [1, 3, 4] | |
j = 0 | |
for el in arr: | |
if el == target[j]: | |
j += 1 | |
else: | |
j = 0 | |
if j == len(target): | |
return True | |
return False | |
assert fn([0, 1, 2, 1, 3, 4, 5]) == True | |
assert fn([1, 3, 4]) == True | |
assert fn([1, 3]) == False | |
assert fn([]) == False | |
assert fn([1, 3, 5]) == False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment