algorithms.tutorialhorizon.com
Replace array elements with maximum element on the right | Algorithms
Given an array of integers, write a program to replace its elements with the maximum element on the right side from their respective positions. Note: If the element is equal to the maximum element on the right, replace it with 0. Example: Original Array: [2, 5, 1, 6, 3, 4] Output: [6, 6, 6, 0, 4, 0]