Skip to main content

Flipkart

Flipkart OA 2023 - Conference Schedule


A schedule has been released for an upcoming tech conference. The schedule provides the start and end times of each presentation. Once a presentation has begun, no one can enter or leave the room. It takes no time to move from one presentation to another.

Your task is to determine the maximum number of presentations that can be attended by one person.

Input Format:

  • The first line contains an integer n, the number of presentations.
  • The second line contains n space-separated integers representing the start times of the presentations.
  • The third line contains n space-separated integers representing the end times of the presentations.

Output Format:

  • Print a single integer representing the maximum number of presentations that one person can attend.

Example:

Input:

3
1 1 2
3 2 4

Output:

2

Explanation:

Using 0-based indexing:

  • An attendee can attend presentation 1 (starting at 1, ending at 2) and presentation 2 (starting at 2, ending at 4).
  • Presentation 0 (starting at 1, ending at 3) overlaps with presentation 1 and 2, so it cannot be attended along with any other presentation.

Thus, the maximum number of presentations that can be attended is 2.


Constraints:

  • (1 <= n <= 10^5)
  • (1 <= scheduleStart[i], scheduleEnd[i] <= 10^9)