Skip to content

Latest commit

 

History

History
56 lines (30 loc) · 1.34 KB

README_EN.md

File metadata and controls

56 lines (30 loc) · 1.34 KB

中文文档

Description

Imagine you are reading in a stream of integers. Periodically, you wish to be able to look up the rank of a number x (the number of values less than or equal to x). lmplement the data structures and algorithms to support these operations. That is, implement the method track (int x), which is called when each number is generated, and the method getRankOfNumber(int x), which returns the number of values less than or equal to x.

Note: This problem is slightly different from the original one in the book.

Example:

Input:

["StreamRank", "getRankOfNumber", "track", "getRankOfNumber"]

[[], [1], [0], [0]]

Output:

[null,0,null,1]

Note:

  • x <= 50000
  • The number of calls of both track and getRankOfNumber methods are less than or equal to 2000.

Solutions

Python3

Java

...