Python3 ||  11 lines, flatten the path  || T/S: 93% / 11%
Here's the intuition:

In the Manhattan metric, each iterate is either one greater or less than the previous. Thus, we can model this path with a 1D array, path
Here's the intuition:
- In the *Manhattan* metric, each iterate is either one greater or less than the previous. Thus, we can model this path with a 1D array, *path*.

- In the model, we require *N* and *S* to be of opposite parity, as well as *E* and *W*. Thus, we must allow for four possible orderings.
```python3 []
class Solution:
    def maxDistance(self, s: str, k: int) -> int:

        def makepath(pair):
            nonlocal k
            path, kk = [-1] * len(s), k

            for i, ch in enumerate(s):
                if ch in pair: 
                    path[i] = 1

                elif kk > 0:
                    path[i] = 1
                    kk-= 1

            return max(accumulate(path))
        
        return max(map(makepath, ['NE', 'NW', 'SE', 'SW']))
```
[https://leetcode.com/problems/maximum-manhattan-distance-after-k-changes/submissions/1530171677/](https://leetcode.com/problems/maximum-manhattan-distance-after-k-changes/submissions/1530171677/)

I could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*) / *O*(*N*), in which *N* ~ `len(s)`.
['Python3']