diff --git "a/leetcode3/\354\227\274\355\230\234\354\240\225/4056. Number of Intersecting Interval Pairs I.java" "b/leetcode3/\354\227\274\355\230\234\354\240\225/4056. Number of Intersecting Interval Pairs I.java" new file mode 100644 index 00000000..f32aae7d --- /dev/null +++ "b/leetcode3/\354\227\274\355\230\234\354\240\225/4056. Number of Intersecting Interval Pairs I.java" @@ -0,0 +1,16 @@ +class Solution { + public int countIntersections(int[][] intervals) { + int count = 0; + + for (int i = 0; i < intervals.length - 1; i++) { + for (int j = i + 1; j < intervals.length; j++) { + if (Math.max(intervals[i][0], intervals[j][0]) + <= Math.min(intervals[i][1], intervals[j][1])) { + count++; + } + } + } + + return count; + } +}