FastPrepEarliest Time to Schedule a Meeting
Problems/Earliest Time to Schedule a Meeting

Earliest Time to Schedule a Meeting

Microsoft logoMicrosoft● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names the same task but does not include the original wording, examples or limits. The statement, examples and limits here come from our version of the task.

Our version is about 95% the same as the reported question.

Special thanks: 🌷 A special thank you to a lovely, amazing fren for sharing that this question appeared in an interview on October 11, 2026! ( ˘͈ ᵕ ˘͈♡) 🧡

You are given an array of strings schedules. Each string has the form "<name> <activity> <start> <end>", for example "Alex work 01:00 13:30". It means that the person name is busy with activity from start to end, and both endpoints are included. Times use the 24-hour HH:MM format. One person can have several entries, and the entries can belong to different people. You are also given an integer k, the meeting length in minutes.

A day is made of the minutes 00:00, 00:01, ..., 23:59. An entry blocks every minute from start through end. A meeting of length k that starts at minute s uses the k minutes s, s + 1, ..., s + k - 1. It must start and finish on the same day, so its last minute is 23:59 at the latest.

Everyone who appears in schedules must attend, so no minute of the meeting can be blocked by any entry. Return the earliest possible start time as a string in HH:MM format, or "-1" if no start time works.

Function

earliestMeetingTime(schedules: String[], k: int) → String

Examples

Example 1

schedules = ["Alex work 01:00 13:30","Sam sleep 00:00 08:00","Alex lunch 13:46 14:00"]k = 15return = "13:31"

Together the entries block 00:00 through 13:30 (Sam's sleep overlaps Alex's work), then 13:46 through 14:00. Because 13:30 itself is blocked, the first free minute is 13:31. The minutes 13:31 through 13:45 are exactly 15 free minutes, so the meeting starts at "13:31".

Example 2

schedules = ["Alex work 01:00 13:30","Sam sleep 00:00 08:00","Alex lunch 13:46 14:00"]k = 16return = "14:01"

The gap from 13:31 through 13:45 has only 15 minutes, one too few. The next free minute after Alex's lunch is 14:01, and the rest of the day is free, so the answer is "14:01".

Example 3

schedules = ["Ana meeting 00:00 23:00"]k = 60return = "-1"

The only free minutes are 23:01 through 23:59, which is 59 minutes. A 60-minute meeting would have to end after 23:59, so no start time works and the answer is "-1".

Constraints

  • 1 <= schedules.length <= 10^4
  • Each schedules[i] is name, activity, start, and end separated by single spaces.
  • name and activity each have 1 to 10 English letters.
  • start and end are valid times from 00:00 to 23:59 in HH:MM format, and start is not later than end.
  • 1 <= k <= 1440

More Microsoft Online Assessment questions

  • Minimum Cost to Process Priority TasksOA · Seen Nov 2026
  • Most Visited Sprint MarkerOA · Seen Nov 2026
  • Maximum Escape Game ScoreOA · Seen Nov 2026
  • Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
  • Maximum Interactive Team SizeOA · Seen Nov 2026
  • Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
  • Minimum Cost K-Capable ModelsOA · Seen Nov 2026
  • Find Available Meeting RoomsOA · Seen Oct 2026
  • Maximum Sum of a K-StarOA · Seen Oct 2026
  • Capacity to Ship Packages Within DaysOA · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Earliest Time to Schedule a MeetingMathWorks · OAMathWorks interview questions
  • Earliest Meeting Start on a 24-Hour ClockIMC Trading · OAIMC Trading interview questions
  • Earliest Common Meeting StartVisa · OAVisa interview questions
  • Smallest Most-Lit Street PositionHudson River Trading · OAHudson River Trading interview questions
  • Most Visited Sprint MarkerChubb · OAChubb interview questions
  • Earliest Common Meeting TimeZipRecruiter · OAZipRecruiter interview questions
  • File Download Coverage PercentagePersona · OAPersona interview questions
  • Stars Between Bars in RangesExpedia · OAExpedia interview questions
  • Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions
  • Majority Labels over Audio IntervalsNooks · PHONE SCREEN

Microsoft interview experiences

  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
  • Microsoft SWE Intern, Early 2026: 54 Experiences (Part 2 of 6)
  • Microsoft SWE Intern Interviews: 244 Experiences (Part 1 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public String earliestMeetingTime(String[] schedules, int k) {
        // Write your solution here.
    }
}
Checking account…