Skip to content

Instantly share code, notes, and snippets.

@shuson
Created July 11, 2017 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuson/bd2185b72114f868bb59d6affefca4da to your computer and use it in GitHub Desktop.
Save shuson/bd2185b72114f868bb59d6affefca4da to your computer and use it in GitHub Desktop.
def sol(A):
n = len(A)
for i in range(n):
j = n-1
while j > i:
if A[i] == A[j]:
return j - i
j -= 1
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment