FastPrepMinimum Classrooms for Courses
Problems/Minimum Classrooms for Courses

Minimum Classrooms for Courses

Google logoGoogle● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand personal blog says a Google 2026 SWE intern calendar-layout question was first broken down into finding the minimum number of classrooms from course start and end times. We wrote the rule for interval ends, the standalone signature, the input limits, and the examples. So this smaller task is about 94% the same as the reported question.

You are given an array courses, where courses[i] = [starti, endi] is the scheduled time of the i-th course.

Each classroom can host at most one course at a time. A classroom becomes available immediately when a course ends, so a course ending at time t does not overlap a course starting at time t.

Return the minimum number of classrooms required to hold every course at its scheduled time.

Function

minimumClassrooms(courses: int[][]) → int

Examples

Example 1

courses = [[0,30],[5,10],[15,20]]return = 2

The courses [0,30] and [5,10] overlap, so at least two classrooms are necessary. Two are also sufficient.

Example 2

courses = [[1,5],[5,8],[8,9]]return = 1

Every course starts when or after the previous course ends, so one classroom can be reused.

Example 3

courses = [[4,10],[4,10],[4,10]]return = 3

All three courses run at the same time, so each needs a separate classroom.

Constraints

  • 1 <= courses.length <= 100000.
  • courses[i].length == 2.
  • 0 <= starti < endi <= 1000000000.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
  • Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
  • Merge K Sorted Interval ListsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Employee Free TimeIDFC Bank · ONSITE INTERVIEWIDFC Bank interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions

Interview reports that mention this question

  • Google SWE Intern Onsite Questions: 16 Experiences (Part 2 of 3)

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int minimumClassrooms(int[][] courses) {
        // Write your code here.
    }
}
Checking account…