From 0916a34ca4b5899995856ff15b46ac089c3c7b3e Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Tue, 5 May 2026 22:15:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[=EC=9D=B4=EC=A7=84=ED=9D=AC]=20Day05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2374_Node With Highest Edge Score.java" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" new file mode 100644 index 00000000..f0f2fc48 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" @@ -0,0 +1,30 @@ +/* + +1. 아이디어 : + +2. 시간복잡도 : O(N) + +3. 자료구조/알고리즘 : 투포인터 + + */ + +class Solution { + public int edgeScore(int[] edges) { + long[] numSum = new long[edges.length]; + long maxSum = -1; + int ans = -1; + + for(int i=0; i Date: Tue, 5 May 2026 22:19:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[=EC=9D=B4=EC=A7=84=ED=9D=AC]=20Day05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2374_Node With Highest Edge Score.java" | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" index f0f2fc48..f97beae2 100644 --- "a/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/2374_Node With Highest Edge Score.java" @@ -1,10 +1,12 @@ /* -1. 아이디어 : +1. 아이디어 : 0, n-1까지의 노드 중, 본인을 가리키는 서로 다른 노드의 인덱스 합이 가장 큰 노드 구하기 + long[] 으로 n-1크기의 배열을 선언후, for문으로 계산 + 이후 다시 for문으로 계산된 합을 돈 뒤, 인덱스는 가장 작되, 합이 가장 큰 노드를 구한다 -2. 시간복잡도 : O(N) +2. 시간복잡도 : O(N) + O(N) => O(N) -3. 자료구조/알고리즘 : 투포인터 +3. 자료구조/알고리즘 : 단순계산 */