- Source : https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3259/
- Author : Han
- Date : 2022-01-03
Problems
Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1.
After doing so, return the array.
Example 1
1 | |
Example 2
1 | |
###Solution
1 | |