Atenţie! Aceasta este o versiune veche a paginii, scrisă la 2017-02-24 07:36:15.
Revizia anterioară   Revizia următoare  

Interview puzzle: Count distinct (2)

Cosmin
Cosmin Negruseri
24 februarie 2017

Here's a fun question I've heard recently:

Website visit counter: Given n log lines from a website, design a datastructure that can respond to count_distinct queries efficiently. Log lines are given in order and contain a timestamp (int64) and a user_id (int_64). count_distinct queries have a two int64 parameters: start_time and end_time. For each query you have to return the number of distinct users that have visited the website in the time range [start_time, end_time].

Categorii: