Skip to content

Instantly share code, notes, and snippets.

@zigzackey
Created March 29, 2016 08:06
Show Gist options
  • Save zigzackey/bd1bae6efe3ce845519e to your computer and use it in GitHub Desktop.
Save zigzackey/bd1bae6efe3ce845519e to your computer and use it in GitHub Desktop.
if __name__ == '__main__':
n = int(input())
R = [int(input()) for i in range(n)]
minv = R[0]
maxv = R[1] - R[0]
for j in range(1, n):
if (maxv < R[j] - minv):
maxv = R[j] - minv
if (R[j] < minv):
minv = R[j]
print(maxv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment