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

Given an integer array arr, partition the array into (contiguous) subarrays of length at most k. After partitioning, each subarray has their values changed to become the maximum value of that subarray.
Return the largest sum of the given array after partitioning. Test cases are generated so that the answer fits in a 32-bit integer.
 
Please complete the following python code precisely:
```python
class Solution:
    def maxSumAfterPartitioning(self, arr: List[int], k: int) -> int:
```