From a5aa6c27323052da2362dc3857f2e6ea5a2df365 Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Mon, 12 Oct 2026 22:12:48 +0900 Subject: [PATCH 1/2] 4056. Number of Intersecting Interval Pairs I --- ...ber of Intersecting Interval Pairs I.java" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/4056. Number of Intersecting Interval Pairs I.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/4056. Number of Intersecting Interval Pairs I.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/4056. Number of Intersecting Interval Pairs I.java" new file mode 100644 index 00000000..4f20cb85 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/4056. Number of Intersecting Interval Pairs I.java" @@ -0,0 +1,28 @@ +/* + +1. 아이디어 : 각 구간의 시작점과 끝점이 주어졌을때, 구간별 겹치는 개수 파악하기 + 두 구간이 겹치는 경우의 수는 포함과 일부 겹침 두개가 존재하므로, 겹치지 않는 경우로 체크 + 모든 배열을 완전탐색해서 구간 a의 end가 구간 b의 start보다 작거나 반대 경우만 제외 + +2. 시간복잡도 : O(N^2) + +3. 자료구조/알고리즘 : 완전탐색 + + */ + +class Solution { + public int countIntersectingIntervals(int[][] intervals) { + + int len = intervals.length; + int ans = 0; + + for(int i=0; i Date: Mon, 12 Oct 2026 22:19:01 +0900 Subject: [PATCH 2/2] 2350. Shortest Impossible Sequence of Rolls --- ...hortest Impossible Sequence of Rolls.java" | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/2350. Shortest Impossible Sequence of Rolls.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/2350. Shortest Impossible Sequence of Rolls.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/2350. Shortest Impossible Sequence of Rolls.java" new file mode 100644 index 00000000..3a8c994c --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/2350. Shortest Impossible Sequence of Rolls.java" @@ -0,0 +1,49 @@ +/* +1. 아이디어: 풀이법을 고민하다가 AI에게 질문 + 핵심은 1부터 k크기의 모든 배열에서 존재하지 않는 배열의 최소길이를 구하기 + + 이때 모든 경우의 수는 구할수 없음 (최대 사이즈 10000) + + 그렇다면 모든 배열이 존재 가능한 조건을 판단 + 1 ~ k 개의 원소가 모두 존재하는 범위를 기준으로 배열을 나누면 최소 길이 판단 가능 + + ex) 1 1 3 3 2 || 1 3 k = 3 + 위 나눠진 경우를 보면 완전한 배열 1개와 숫자가 1개 부족한 배열 존재 + + 완성된 구간에서는 모든 숫자 중 하나를 선택할 수 있고, + 마지막 미완성 구간에는 반드시 없는 숫자가 존재한다. + +2. 시간복잡도: O(N) + +3. 자료구조/알고리즘: 그리디 +*/ + +class Solution { + public int shortestSequence(int[] rolls, int k) { + // k면체 주사위 n번 굴리기 + + int ans = 0; + int sum = 0; + + boolean[] check = new boolean[k+1]; + + for(int i=0; i