Programming problem: Replace Elements With Greatest Element On Right Side
Traverse the array right to left, tracking the running maximum. Each element gets replaced with the current max before updating it. This avoids the inner loop, reducing time complexity from O(n²) to O(n) with O(1) space.