Tap here to switch tabs
Problem
Submissions

Problem: Maximum of Absolute Value Expression

med
30 min
Try to solve the Maximum of Absolute Value Expression problem.

Statement

Given two integer arrays arr1 and arr2 of equal length, determine the maximum value of the expression:

∣arr1[i]−arr1[j]∣+∣arr2[i]−arr2[j]∣+∣i−j∣|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|

where the maximum is computed across all indices ii and jj such that 0≤i,j<arr1.length0 \le i, j < arr1.length.

Constraints:

  • 2≤arr1.length==arr2.length≤400002 \le arr1.length == arr2.length \le 40000

  • −106≤arr1[i],arr2[i]≤106-10^6 \le arr1[i], arr2[i] \le 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum of Absolute Value Expression

med
30 min
Try to solve the Maximum of Absolute Value Expression problem.

Statement

Given two integer arrays arr1 and arr2 of equal length, determine the maximum value of the expression:

∣arr1[i]−arr1[j]∣+∣arr2[i]−arr2[j]∣+∣i−j∣|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|

where the maximum is computed across all indices ii and jj such that 0≤i,j<arr1.length0 \le i, j < arr1.length.

Constraints:

  • 2≤arr1.length==arr2.length≤400002 \le arr1.length == arr2.length \le 40000

  • −106≤arr1[i],arr2[i]≤106-10^6 \le arr1[i], arr2[i] \le 10^6