Created
March 18, 2020 17:13
-
-
Save BharathKumarS/06980f0b748dd1e2fbea233e28560a0d to your computer and use it in GitHub Desktop.
LeetCode, Replace Elements with Greatest Element on Right Side.
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
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) |
Author
BharathKumarS
commented
Mar 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment