用Gluten Free粉自制面膜,可以去黑头的贴子# Fashion - 美丽时尚
P*e
1 楼
也有可能是我没刷到。
有一个class叫Searcher. 你要写其中两个function: preProcessData, search.
preProcessData takes in an array of positive integers, all unique, and you
can do whatever you want with the array (modify it, sort it, create another
data structure in this class to store its content, etc). And there's no
restriction on space or time complexity.
search takes in 2 integers, x,y. x and y are both in the original array. and
it must return the total number of elements in the array that are between x
and y, exclusive. But must do it in O(1) time.
Example:
array = [2,4,9,5,7,3]
preProcessData (array) search(2,7)
有一个class叫Searcher. 你要写其中两个function: preProcessData, search.
preProcessData takes in an array of positive integers, all unique, and you
can do whatever you want with the array (modify it, sort it, create another
data structure in this class to store its content, etc). And there's no
restriction on space or time complexity.
search takes in 2 integers, x,y. x and y are both in the original array. and
it must return the total number of elements in the array that are between x
and y, exclusive. But must do it in O(1) time.
Example:
array = [2,4,9,5,7,3]
preProcessData (array) search(2,7)