[LeetCode] 493. Reverse Pairs
ProblemExplanationFor an array `[x_1, \dots , x_n],` suppose `(i, j)` is a reverse pair, meaning `x_i > 2x_j`. If there exist indices `k` and `t` such that ``i ``x_i \leq x_{k} \quad \text{and} \quad x_{t} \leq x_j,``then ``x_{k} \ge x_i > 2x_j \quad \text{and} \quad x_i > 2x_j \ge 2x_{t}.`` From these inequalities, it follows that the pairs `(k, t)` , `(i, t)`, and `(k, j)` must also be reverse..
Show More