As reported: Nutanix (2025), round 1 DSA: an unsorted log of web-resource accesses; return the resource with the highest number of accesses in any 5-minute window, together with that count.
Each log entry is [accessTime, userId, resourceId], where accessTime is a string holding seconds since 00:00:00, all on the same day. The log is not sorted. Return the resource with the most accesses within any 5-minute window, and the number of accesses.
Example 1
logs = [["58523","user_1","resource_1"], ["62314","user_6","resource_2"], ["54001","user_1","resource_3"],
["200","user_6","resource_5"], ["215","user_6","resource_4"], ["54060","user_2","resource_3"],
["53760","user_3","resource_3"], ["58522","user_22","resource_1"], ["53651","user_5","resource_3"],
["2","user_6","resource_1"], ["100","user_6","resource_6"], ["400","user_7","resource_2"],
["100","user_8","resource_6"], ["54359","user_1","resource_3"]]
-> ["resource_3", 3] (accesses at 53760, 54001 and 54060)
Example 2
logs = [["300","user_1","resource_3"], ["599","user_1","resource_3"], ["900","user_1","resource_3"],
["1199","user_1","resource_3"], ["1200","user_1","resource_3"], ["1201","user_1","resource_3"],
["1202","user_1","resource_3"]]
-> ["resource_3", 4] (1199, 1200, 1201, 1202)
Example 3
logs = [["300","user_10","resource_5"]] -> ["resource_5", 1]
Clarifications
- Accesses at times
t1 ≤ t2fall in the same 5-minute window whent2 − t1 ≤ 300(as in Example 1: 53760 and 54060). - If several resources tie, return the one with the smallest resource id (string order).
- The user id doesn't matter for the count.
Constraints: 1 ≤ logs.length ≤ 2 · 10^4; 0 ≤ accessTime < 86400.
Code runner format: one JSON value: logs. Implement busiestResource(logs) returning the resource and the count (Python/JS: a pair; Java: Object[]{resource, count}; C++: pair<string,int>; Go: two return values); the harness prints [resource, count].