Please solve the programming task below using a self-contained code snippet in a markdown code block.

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 -1.
After doing so, return the array.
 
Please complete the following python code precisely:
```python
class Solution:
    def replaceElements(self, arr: List[int]) -> List[int]:
```