FastPrepMost Accessed Resource in Five Minutes
Problems/Most Accessed Resource in Five Minutes

Most Accessed Resource in Five Minutes

Indeed logoIndeed● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported resource/count/window-timestamps objective matches the source at about 90%; inclusive boundaries, ties, record grammar, units and output serialization are defined for this exercise.

Each string in logs is userId,resourceId,timestamp. Find the resource with the most accesses in one five-minute window. Return that resource, its count, and every access timestamp in the selected window.

For this exercise, assume timestamps are nonnegative integer seconds. A window starts at an access timestamp s and includes every access to that resource with s <= timestamp <= s + 300. Repeated entries count separately.

For this exercise, assume ties choose the lexicographically smallest resource, then the earliest window start. Return a string array [resourceId,count,timestamp1,...], with decimal count and ascending timestamps, including duplicates. An empty log returns an empty array.

For this exercise, assume records contain exactly three comma-separated fields without spaces and identifiers are nonempty case-sensitive alphanumeric strings.

Function

busiestWindow(logs: String[]) → String[]

Examples

Example 1

logs = ["u1,b,0","u2,a,0","u3,a,150","u4,a,300","u5,a,301"]return = ["a","3","0","150","300"]

Resource a has three accesses in [0,300]; [150,450] also has three, so the earlier start is selected.

Example 2

logs = ["u,b,10","v,a,20"]return = ["a","1","20"]

Both resources have one access, so lexicographically smaller a wins.

Constraints

  • For this exercise, assume 0 <= logs.length <= 2000.
  • Identifier lengths are from 1 to 30.
  • Timestamps are from 0 through 10^9.

More Indeed Phone Screen questions

  • Insert into an Unrolled Linked ListPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Course Completion OrderPHONE SCREEN · Seen May 2025
  • Recipes You Can PreparePHONE SCREEN · Seen May 2025
  • Rotting Orange PropagationPHONE SCREEN · Seen May 2025
  • Courses Shared by Every Student PairPHONE SCREEN · Seen Aug 2022
  • First and Last Access Time per UserPHONE SCREEN · Seen Jul 2022
  • Resource Transition GraphPHONE SCREEN · Seen Jul 2022
  • Count Disappearing Connected TilesPHONE SCREEN · Seen Jul 2022
  • First Dictionary Word from Note LettersPHONE SCREEN · Seen Jul 2022
  • Word Path Moving Only Right or DownPHONE SCREEN · Seen Jul 2022

Similar questions at other companies

  • Classify Password StrengthHackerRank · OA · PHONE SCREEN · ONSITE INTERVIEWHackerRank interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
  • Fuzzy Word Lookup With One Misspelled LetterMeta · PHONE SCREENMeta interview questions
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Group Timestamps into Consecutive-Day IntervalsDuolingo · PHONE SCREENDuolingo interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Longest Substring Without Repeating CharactersAngel One · PHONE SCREEN

Interview reports that mention this question

  • Indeed Experienced SWE Karat Screens and OAs: 6 Experiences

Indeed interview experiences

  • Indeed SWE Intern Karat Screens and OA: 3 Experiences
  • Indeed New Grad SWE Online Assessments: 3 Experiences
All Indeed interview questionsSee Indeed hiring insights
Saved
class Solution {
    public String[] busiestWindow(String[] logs) {
        // Write your code here.
        return new String[0];
    }
}
Checking account…