1299. Replace Elements with Greatest Element on Right Side
https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side
Description
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:
Example 2:
Constraints:
1 <= arr.length <= 104
1 <= arr[i] <= 105
ac
Previous1298. Maximum Candies You Can Get from BoxesNext1300. Sum of Mutated Array Closest to Target
Last updated