Last active
June 25, 2021 13:21
-
-
Save asraraljuhani/587a68a0751dcd6bad12fb532d9db84b 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_permutation(arr1, arr2): | |
if len(arr1) == 0 or len(arr2) == 0 or len(arr1) != len(arr2): | |
return False | |
else: | |
for i in range(len(arr1)): | |
if arr1[i] != arr2[len(arr2)-1-i]: | |
return False | |
return True | |
print(is_permutation("toot", "ioot")) | |
print(is_permutation([1, 2, 3, 4, 5], [5, 4, 3, 2, 1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment