Attend the Most Conference Sessions, One Per Day

Last updated: November 29, 2026

Quick Overview

Each Google I/O session i can be attended on any single day in [start_i, end_i]. You can attend at most one session per day. Return the maximum number of sessions you can attend.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each Google I/O session i can be attended on any single day in [start_i, end_i]. You can attend at most one session per day. Return the maximum number of sessions you can attend.

A Google onsite greedy question in a developer-conference planner frame. The interviewer wants the sweep over days with a min-heap of end days, and a reason why picking the session that expires soonest is optimal.

What the Interviewer Expects
  • Sorts sessions by start day
  • Sweeps days and pushes newly open sessions
  • Discards sessions whose end day has passed
  • Attends the one with the earliest end day
  • Argues optimality with an exchange argument
Key Topics to Cover
Min-Heap
Greedy
Sweep Line
Intervals
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • What if sessions have different values?
  • What if you can attend up to two per day?
  • Return the actual schedule
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: list of (start, end) inclusive day ranges.
  • Each attended session uses one day in its range; one session per day.
  • Output: max sessions attended....
High-Level Design

Sweep day by day. On each day, push the end day of every session that opens today into a min-heap, then drop expired ones (end < today). If anything remains, attend the session with the earliest end d...


Submit Your Answer
Markdown supported