← All problemsSign in

493. Reverse Pairs

LeetCodeArrayBinary SearchDivide and ConquerBinary Indexed TreeSegment TreeMerge SortOpen on judge ↗

Given an integer array nums, return the number of reverse pairs in the array. A reverse pair is a pair (i, j) where: - 0 <= i < j < nums.length and - nums[i] > 2 * nums[j]. Example 1: Input: nums = [1,3,2,3,1] Output: 2 Explanation: The reverse pairs are: (1, 4) --> nums[1] = 3, nums[4] = 1, 3 > 2 * 1 (3, 4) --> nums[3] = 3, nums[4] = 1, 3 > 2 * 1 Example 2: Input: nums = [2,4,3,5,1] Outp

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start