Complete Post - https://tutorialhorizon.com/algorithm...
Given an array of numbers nums[], write ment a function to replace each element of the array with the greatest element present to its right side. Replace the last element with -1.
Example:
Input: [4, 5, 2, 25, 13, 16, 8]
Output: [25, 25, 25, 16, 16, 8, -1]