leetle

Daily challenge for 2025-04-29

119. Replace Elements with Greatest on Right

Write a function solve that replaces each element with the greatest element to its right, and the last element with -1.

Example:
Input: [17,18,5,4,6,1]
Output: [18,6,6,6,1,-1]

Run this challenge interactively in Python or JavaScript when the app loads.