From 6655417001503c1533cff80214d3429b49500157 Mon Sep 17 00:00:00 2001 From: rimogsu Date: Tue, 1 Sep 2026 22:24:05 +0900 Subject: [PATCH] 877,3833 --- .../v2/3833. Count Dominant Indices.py" | 26 +++++++++++++++++++ .../v2/877. Stone Game.py" | 15 +++++++++++ 2 files changed, 41 insertions(+) create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v2/3833. Count Dominant Indices.py" create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v2/877. Stone Game.py" diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3833. Count Dominant Indices.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3833. Count Dominant Indices.py" new file mode 100644 index 00000000..4c1dbf86 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3833. Count Dominant Indices.py" @@ -0,0 +1,26 @@ +''' +1. 아이디어 : +문제에 명시되어있는 것 그대로 구현한다. + +2. 시간복잡도 : +o(n^2) + +3. 자료구조/알고리즘 : +''' +class Solution: + def dominantIndices(self, nums: List[int]) -> int: + n = len(nums) + ans = 0 + for i in range(n-1): + _sum = 0 + _len = n - i - 1 + print(i, _len) + for j in range(i+1,n): + _sum += nums[j] + + avg = _sum / _len + + if avg < nums[i]: + ans +=1 + + return ans \ No newline at end of file diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v2/877. Stone Game.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/877. Stone Game.py" new file mode 100644 index 00000000..5111a876 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/877. Stone Game.py" @@ -0,0 +1,15 @@ + +''' +1. 아이디어 : +따지고 보면 먼저 돌을 가져가는 사람이 항상 이길 것이라고 생각이 들었음. +선공이 짝수번째만 가져간다고 생각하면 짝수만 가져갈 수 있음. 홀수만 가져간다고 하면 홀수만 가져갈 수 있음. +return True 하니까 답이라고 한다. + +2. 시간복잡도 : +o(1) + +3. 자료구조/알고리즘 : +''' +class Solution: + def stoneGame(self, piles: List[int]) -> bool: + return True \ No newline at end of file