Search
⌘K

Leetcode 1131. Maximum of Absolute Value Expression

Given two equal-length arrays, compute the maximum value of |arr1[i]-arr1[j]| + |arr2[i]-arr2[j]| + |i-j| over all pairs (i,j) by observing the expression reduces to a constant set of sign patterns; evaluate the four resulting linear forms across indices and take the largest max−min difference (O(n) time).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.