Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i.
You are given two integer arrays a and b of length n.
You can reverse at most one subarray (continuous subsegment) of the array a.
Your task is to reverse such a subarray that the sum ∑ i = 1 n a [ i ] ⋅ b [ i ] \sum_{i=1}^na[i]⋅b[i]∑
i=1
n
a[i]⋅b[i] is maximized.