Overlapping Intervals Problem Statement

You are given the start and end times of 'N' intervals. Write a function to determine if any two intervals overlap.

Note:

If an interval ends at time T and another interval starts at the same time, they are not considered overlapping intervals.

Input:

The first line contains an integer 'T', the number of test cases. 
The first line of each test case contains an integer 'N', the number of intervals.
The second line contains 'N' space-separated integers representing the starting times of the intervals.
The third line contains 'N' space-separated integers representing the ending times of the intervals.

Output:

For each test case, return true if there are overlapping intervals, otherwise return false.
Example:
Input: 
T = 2
Test Case 1:
N = 2
Starts = [1, 3]
Ends = [2, 4]
Test Case 2:
N = 2
Starts = [1, 2]
Ends = [2, 3]
Output: 
Test Case 1: True
Test Case 2: False

Constraints:

  • 1 ≤ T ≤ 102
  • 0 ≤ N ≤ 105
  • 0 ≤ Start[i] ≤ 1015
  • 1 ≤ End[i] ≤ 1015
  • Time Limit: 1 sec
AnswerBot
4mo

Given start and end times of intervals, determine if any two intervals overlap.

  • Iterate through intervals and check if any two intervals overlap by comparing their start and end times

  • Sort intervals bas...read more

Help your peers!
Select
Add answer anonymously...

SAP Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. Implement a stack using queues.
A Software Developer was asked 9mo agoQ. Write a function that reverses a string.
A Software Developer was asked 10mo agoQ. Implement a stack using other data structures.

Popular interview questions of Software Developer

A Software Developer was asked 5mo agoQ1. If you have 1 million requests, how will you manage that?
A Software Developer was asked 9mo agoQ2. Implement a stack using queues.
A Software Developer was asked 9mo agoQ3. Write a function that reverses a string.

Top HR questions asked in SAP Software Developer

A Software Developer was asked 8mo agoQ1. Introduce yourself.
A Software Developer was asked 10mo agoQ2. What is your top priority when choosing a new job?
A Software Developer was asked 10mo agoQ3. Tell me about your current project and the technologies you are using.
SAP Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits