Skip to content

Commit f787ec4

Browse files
authored
Create 4056. Number of Intersecting Interval Pairs I
1 parent 1c25379 commit f787ec4

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @param {number[][]} intervals
3+
* @return {number}
4+
*/
5+
var countIntersectingIntervals = function(intervals) {
6+
let count = 0;
7+
8+
for (let i = 0; i < intervals.length; i++){
9+
for (let j = i+1; j<intervals.length; j++){
10+
if (intervals[i][0] <= intervals[j][1] && intervals[j][0] <= intervals[i][1]){
11+
count++;
12+
}
13+
}
14+
}
15+
return count;
16+
};
17+

0 commit comments

Comments
 (0)