【Day 31 】2021-06-09 - 762.Number Stream to Intervals

题目描述

762.Number Stream to Intervals

入选理由

暂无

题目地址

https://binarysearch.com/problems/Triple-Inversion

前置知识

  • 二分法

题目描述

Given a list of integers nums, return the number of pairs i < j such that nums[i] > nums[j] * 3.

Constraints
 
n ≤ 100,000 where n is the length of nums
 Example 1
Input
 nums = [7, 1, 2]
Output
2
Explanation
We have the pairs (7, 1) and (7, 2)

解法一

时空复杂度

时间复杂度:O(logN)

空间复杂度: O(n)

参考回答