Skip to content

Commit 5cd76a1

Browse files
Merge pull request #2164 from CodingTestStudy2/최원준
[최원준] 2026/10/12
2 parents cbbd1ed + c2ea3df commit 5cd76a1

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution:
2+
def countIntersectingIntervals(self, intervals: list[list[int]]) -> int:
3+
4+
def check_intersect(point1, point2):
5+
s1, e1 = point1
6+
s2, e2 = point2
7+
8+
if e1 < s2:
9+
return False
10+
if e2 < s1:
11+
return False
12+
return True
13+
14+
n = len(intervals)
15+
ans = 0
16+
for i in range(n):
17+
for j in range(i+1, n):
18+
if check_intersect(intervals[i], intervals[j]):
19+
ans+=1
20+
return ans

0 commit comments

Comments
 (0)