Skip to content

Instantly share code, notes, and snippets.

@st0le
Created May 18, 2013 04:40
Show Gist options
  • Save st0le/5603263 to your computer and use it in GitHub Desktop.
Save st0le/5603263 to your computer and use it in GitHub Desktop.
max_diff_naive
def max_diff_naive(L):
max_diff = start = end = 0
for i in xrange(len(L)):
for j in xrange(i+1,len(L)):
if max_diff < L[j] - L[i]:
start,end = i,j
max_diff = L[j] - L[i]
return max_diff,start,end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment