Skip to content

Latest commit

 

History

History
61 lines (28 loc) · 987 Bytes

File metadata and controls

61 lines (28 loc) · 987 Bytes

中文文档

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:

Input: arr = [17,18,5,4,6,1]

Output: [18,6,6,6,1,-1]

 

Constraints:

    <li><code>1 &lt;= arr.length &lt;= 10^4</code></li>
    
    <li><code>1 &lt;= arr[i] &lt;= 10^5</code></li>
    

Solutions

Python3

Java

...