Find cycle in interval list

Last updated: September 2, 2025

Quick Overview

Given a list of intervals, determine if there is a cycle present in the intervals. An interval is defined by a start and end time, and a cycle occurs when one interval overlaps with another. Your solution should return a boolean value indicating whether a cycle exists in the provided list of intervals.

Adobe
Coding & Algorithms
Software Engineer
Adobe
September 2, 2025
Software Engineer
Phone Screen
Coding & Algorithms
Easy

2

5

162 solved


Given a list of intervals, determine if there is a cycle present in the intervals. An interval is defined by a start and end time, and a cycle occurs when one interval overlaps with another. Your solution should return a boolean value indicating whether a cycle exists in the provided list of intervals.

Adobe uses this problem in the Phone Screen to evaluate your algorithmic thinking. They expect you to discuss multiple approaches, analyze trade-offs between them, and implement the optimal solution with clean, readable code.

What the Interviewer Expects
  • Identify the correct data structure and algorithm for the problem
  • Write clean, bug-free code with proper variable naming
  • Analyze time and space complexity correctly
  • Handle basic edge cases (empty input, single element)
  • Communicate your thought process while coding
Key Topics to Cover
Data structure selection and trade-offs
Sorting and searching
Common algorithm patterns (sliding window, two pointers, BFS/DFS)
Time and space complexity analysis
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
  • Can you optimize the space complexity of your solution?
  • What is the worst-case input for your solution?
  • What happens if the input contains duplicates?
  • How would you parallelize this solution?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Problem Analysis

To determine if there is a cycle in a list of intervals, we need to check for overlaps between intervals. An overlap occurs if the start time of one interval is less than the end time of another inter...

Approach
  1. Sort the Intervals: First, we sort the list of intervals based on their start times. For example, if we have intervals [(1, 3), (2, 4), (5, 6)], after sorting, they would remain the same becaus...

Submit Your Answer
Markdown supported

Related Questions