Skip to content

Instantly share code, notes, and snippets.

@BharathKumarS
Created March 18, 2020 17:13
Show Gist options
  • Save BharathKumarS/06980f0b748dd1e2fbea233e28560a0d to your computer and use it in GitHub Desktop.
Save BharathKumarS/06980f0b748dd1e2fbea233e28560a0d to your computer and use it in GitHub Desktop.
LeetCode, Replace Elements with Greatest Element on Right Side.
arr = [17,18,5,4,6,1]
for num in range(len(arr)-1):
arr[num] = max(arr[num+1:])
arr[len(arr)-1] = -1
print(arr)
@BharathKumarS
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment