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
After doing so, return the array.
Input: arr = [17,18,5,4,6,1]
1 <= arr.length <= 10^4
1 <= arr[i] <= 10^5