Replace Elements with Greatest Element on Right Side (Leetcode 1299)

Опубликовано: 08 Июнь 2026
на канале: Coding Interviews
1,804
10

Amazon, Microsoft, Google, Facebook, Netflix, Apple

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.