From 7722fd6bcca1db40e08b294732c25358dc51f1f0 Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Thu, 5 Nov 2026 22:43:54 +0900 Subject: [PATCH 1/2] 3857. Minimum Cost to Split into Ones --- ...857. Minimum Cost to Split into Ones.java" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/3857. Minimum Cost to Split into Ones.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/3857. Minimum Cost to Split into Ones.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/3857. Minimum Cost to Split into Ones.java" new file mode 100644 index 00000000..a6b39c32 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/3857. Minimum Cost to Split into Ones.java" @@ -0,0 +1,22 @@ +/* + +1. 아이디어 : x를 a+b로 나누었을때 최소 비용 + 1 + x-1로 1이 될때까지 나누면 최소 + +2. 시간복잡도 : O(N) + +3. 자료구조/알고리즘 : 그리디 + + */ + +class Solution { + public int minCost(int n) { + int ans = 0; + + for(int i=1; i Date: Thu, 5 Nov 2026 22:47:17 +0900 Subject: [PATCH 2/2] 1733. Minimum Number of People to Teach --- ...3. Minimum Number of People to Teach.java" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/1733. Minimum Number of People to Teach.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/1733. Minimum Number of People to Teach.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/1733. Minimum Number of People to Teach.java" new file mode 100644 index 00000000..e5f531fe --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/1733. Minimum Number of People to Teach.java" @@ -0,0 +1,60 @@ +/* + +1. 아이디어 : 각 사람별로 가능한 언어를 별로의 boolean 배열에 저장, 이후 친구 관계 배열을 순환하며 서로 소통이 되지 않는 언어만 need 배열에 별도 기록 + 다음 완전탐색으로 n=1 ~ n까지 전부 돌며 각 언어에서 가르쳐야 하는 인원을 체크 후 최소 인원으로 return + +2. 시간복잡도 : O(N*M) + +3. 자료구조/알고리즘 : 그리디, 배열 사용 + + */ + +class Solution { + // 언어중 하나를 선택해서 가르쳐야 하는 최소 인원 + public int minimumTeachings(int n, int[][] languages, int[][] friendships) { + int m = languages.length; + + boolean[][] knownLanguages = new boolean[m+1][n+1]; + + for(int i=0; i