<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:
    def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int:
        n = len(arr1)
        
        # Initialize variables to store the minimum and maximum values
        min_val1, max_val1 = float('inf'), float('-inf')
        min_val2, max_val2 = float('inf'), float('-inf')
        min_val3, max_val3 = float('inf'), float('-inf')
        min_val4, max_val4 = float('inf'), float('-inf')
        
        for i in range(n):
            # Update the minimum and maximum values for each case
            min_val1 = min(min_val1, arr1[i] + arr2[i] + i)
            max_val1 = max(max_val1, arr1[i] + arr2[i] + i)
            
            min_val2 = min(min_val2, arr1[i] + arr2[i] - i)
            max_val2 = max(max_val2, arr1[i] + arr2[i] - i)
            
            min_val3 = min(min_val3, arr1[i] - arr2[i] + i)
            max_val3 = max(max_val3, arr1[i] - arr2[i] + i)
            
            min_val4 = min(min_val4, arr1[i] - arr2[i] - i)
            max_val4 = max(max_val4, arr1[i] - arr2[i] - i)
        
        # Calculate the maximum possible value for each case
        max_diff1 = max_val1 - min_val1
        max_diff2 = max_val2 - min_val2
        max_diff3 = max_val3 - min_val3
        max_diff4 = max_val4 - min_val4
        
        # Return the maximum difference among all cases
        return max(max_diff1, max_diff2, max_diff3, max_diff4)

# Example usage:
solution = Solution()
arr1 = [1, 2, 3, 4]
arr2 = [-1, 4, 5, 6]
print(solution.maxAbsValExpr(arr1, arr2))  # Output: 13

arr1 = [1, -2, -5, 0, 10]
arr2 = [0, -2, -1, -7, -4]
print(solution.maxAbsValExpr(arr1, arr2))  # Output: 20
23500