java.lang.Object
g1101_1200.s1131_maximum_of_absolute_value_expression.Solution

public class Solution extends Object
1131 - Maximum of Absolute Value Expression.<p>Medium</p> <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 <= i, j < arr1.length</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> arr1 = [1,2,3,4], arr2 = [-1,4,5,6]</p> <p><strong>Output:</strong> 13</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> arr1 = [1,-2,-5,0,10], arr2 = [0,-2,-1,-7,-4]</p> <p><strong>Output:</strong> 20</p> <p><strong>Constraints:</strong></p> <ul> <li><code>2 <= arr1.length == arr2.length <= 40000</code></li> <li><code>-10^6 <= arr1[i], arr2[i] <= 10^6</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • maxAbsValExpr

      public int maxAbsValExpr(int[] arr1, int[] arr2)