Microsoft | Phone Screen SDE1 | Time of peak hourly active users
Anonymous User
582

Time of peak hourly active users (Is there a leetcode question similar to this one?)

Given the log file with the timestamp ordered entries of the format "unix time,user id" write a function that reads from that log file and identifies the exact second with the peak number of unique users active in the previous hour.

input = ["0001,111", "3600,222", "3601,222", "3602,222", "3603,333", "3604,444", "7204,555"]

0001,111 // Hourly active users: 1, 12:00:01AM
3600,222 // Hourly active users: 2, 1:00:00
3601,222 // Hourly active users: 2, 1:00:01
3602,222 // Hourly active users: 1, 1:00:02
3603,333 // Hourly active users: 2, 1:00:03
3604,444 // Hourly active users: 3, 1:00:04
7204,555 // Hourly active users: 2, 2:00:04

You would return timestamp 3604 which has the most hourly active users 3

Comments (1)