Improve this: unique visitors

A code exercise of about 10 minutes: read the statement, solve «Improve this: unique visitors» in the browser and get a review like in a real interview.

Code · 10 min
Loading…

Statement

This uniqueVisitors(ids) works: it returns how many distinct ids there are. But with a day's logs (hundreds of thousands of visits) it takes too long. Make it fast without changing the result, and explain why it was slow.