美鸡待价而沽 (转载)# Joke - 肚皮舞运动
h*g
1 楼
A period of time where users login and logout, given a sets of login and
logout time pairs, write a function that can show the number of users online
at any given time.
http://www.glassdoor.com/Interview/A-period-of-time-where-users
我感觉直接scan 就行啊 从头到尾 看在哪个区间里, O(n)?
glassdoor 上给的answer 怎么那么复杂呢? 又sort, 又用什么tree的?
logout time pairs, write a function that can show the number of users online
at any given time.
http://www.glassdoor.com/Interview/A-period-of-time-where-users
我感觉直接scan 就行啊 从头到尾 看在哪个区间里, O(n)?
glassdoor 上给的answer 怎么那么复杂呢? 又sort, 又用什么tree的?