<p>Given two arrays of integers with equal lengths, return the maximum value of:</p>

<p><code>|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|</code></p>

<p>where the maximum is taken over all <code>0 &lt;= i, j &lt; arr1.length</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,2,3,4], arr2 = [-1,4,5,6]
<strong>Output:</strong> 13
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,-2,-5,0,10], arr2 = [0,-2,-1,-7,-4]
<strong>Output:</strong> 20
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>2 &lt;= arr1.length == arr2.length &lt;= 40000</code></li>
	<li><code>-10^6 &lt;= arr1[i], arr2[i] &lt;= 10^6</code></li>
</ul>

class Solution:
    # |arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + j - i
    # symmetric
    # assume i <= j
    # case 1: arr1[i] + arr2[i] - arr1[j] - arr2[j] 
    # case 2: arr1[j] + arr2[i] - arr1[i] - arr2[j]
    # case 3: arr1[i] + arr2[j] - arr1[j] - arr2[i]
    # case 4: arr1[j] + arr2[j] - arr1[i] - arr2[i]
    # find the maximum?
    # so at each index we store:
    # arr1[i] + arr2[i] - i
    # -arr1[i] + arr2[i] - i
    # arr1[i] - arr2[i] - i
    # -arr1[i] - arr2[i] - i
    # athen at each j we compute:
    # -arr1[j] - arr2[j] + j
    # arr1[j] - arr2[j] + j
    # -arr1[j] + arr2[j] + j
    # arr1[j] + arr2[j] + j
    # 
    def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int:
        length = len(arr1)
        c1 = float('-inf')
        c2 = float('-inf')
        c3 = float('-inf')
        c4 = float('-inf')
        res = 0
        # [1 -2]
        # [8 8]
        # 
        for i in range(length):
            c1 = max(c1, arr1[i] + arr2[i] - i)
            c2 = max(c2, -arr1[i] + arr2[i] - i)
            c3 = max(c3, arr1[i] - arr2[i] - i)
            c4 = max(c4, -arr1[i] - arr2[i] - i)
            
            t1 = -arr1[i] - arr2[i] + i
            t2 = arr1[i] - arr2[i] + i
            t3 = -arr1[i] + arr2[i] + i
            t4 = arr1[i] + arr2[i] + i

            res = max(res, t1 + c1, t2 + c2, t3 + c3, t4 + c4)
        return res


23800