# LeetCode 252: Meeting Rooms — Step-by-Step Visual Trace

**Easy** — Array | Sorting | Intervals | Greedy

## The Problem

Given an array of meeting time intervals, determine if a person could attend all meetings without any conflicts. Return false if any two meetings overlap in time.

## Approach

Sort the intervals by start time, then iterate through consecutive meetings to check if any meeting starts before the previous one ends. If such an overlap is found, return false; otherwise, return true.

**Time:** O(n log n) · **Space:** O(1)

## Code

```python
class Solution:
    def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
        if not intervals:
            return True

        intervals.sort(key=lambda x: x[0])

        for i in range(1, len(intervals)):
            if intervals[i][0] < intervals[i - 1][1]:
                return False

        return True
```

## Watch It Run

> **[Open interactive visualization](https://tracelit.dev/app?trace=0252_meeting-rooms)**

> **Try it yourself:** Open [TraceLit](https://tracelit.dev/app?trace=0252_meeting-rooms) and step through every line.

---

*Built with [TraceLit](https://tracelit.dev) — the visual algorithm tracer for LeetCode practice.*
