Reverse Pairs
Hard · Arrays & Strings · about 35 minutes
Asked at Google, Amazon, Microsoft, Bloomberg, eBay, Walmart Global Tech, Wayfair, Flipkart, Zalando.
Call a pair of positions i < j in nums *important* when the earlier value is more than twice the later one: nums[i] > 2 * nums[j]. Count the important pairs.