Created
January 29, 2019 17:14
-
-
Save walteraa/78173281f8cc74124144fee3542f485d to your computer and use it in GitHub Desktop.
Hotjar
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 solve(input_list,to_find_list): | |
if len(input_list) < len(to_find_list): | |
return False | |
i = 0 | |
to_find_size = len(to_find_list) | |
while (i + to_find_size) <= len(input_list): | |
if input_list[i:i+to_find_size] == to_find_list: | |
return True | |
i += 1 | |
return False | |
l = [1,2,1,2,1,3,4] | |
m = [1,3,4] | |
assert solve(l,m) | |
m = [2,5,6] | |
assert not solve(l,m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment