Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions leetcode3/변지협/v2/3833. Count Dominant Indices.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions leetcode3/변지협/v2/877. Stone Game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

'''
1. 아이디어 :
따지고 보면 먼저 돌을 가져가는 사람이 항상 이길 것이라고 생각이 들었음.
선공이 짝수번째만 가져간다고 생각하면 짝수만 가져갈 수 있음. 홀수만 가져간다고 하면 홀수만 가져갈 수 있음.
return True 하니까 답이라고 한다.

2. 시간복잡도 :
o(1)

3. 자료구조/알고리즘 :
'''
class Solution:
def stoneGame(self, piles: List[int]) -> bool:
return True