-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f622bf1
commit 5e310ac
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# UTF-8 encoding when using korean | ||
|
||
def solution(N, votes): | ||
vote_counter = [0 for i in range(N+1)] | ||
for i in votes: | ||
vote_counter[i] += 1 | ||
|
||
max_val = max(vote_counter) | ||
|
||
answer = [] | ||
for idx in range(1, N + 1): | ||
if vote_counter[idx] == max_val: | ||
answer.append(idx) | ||
return answer | ||
|
||
N1 = 5 | ||
votes1 = [1,5,4,3,2,5,2,5,5,4] | ||
ret1 = solution(N1, votes1) | ||
|
||
print("solution 함수의 반환 값은", ret1, "입니다.") | ||
|
||
N2 = 4 | ||
votes2 = [1, 3, 2, 3, 2] | ||
ret2 = solution(N2, votes2) | ||
|
||
print("solution 함수의 반환 값은", ret2, "입니다.") |