-
Notifications
You must be signed in to change notification settings - Fork 8
There are no files selected for viewing
This file contains hidden or 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,26 @@ | ||
def main(): | ||
solution(5, [[4, 3], [4, 2], [3, 2], [1, 2], [2, 5]]) | ||
|
||
def solution(n, results): | ||
answer = 0 | ||
board = [[0]*n for _ in range(n)] | ||
|
||
for a,b in results: | ||
board[a-1][b-1] = 1 | ||
board[b-1][a-1] = -1 | ||
|
||
for k in range(n): | ||
for i in range(n): | ||
for j in range(n): | ||
if i == j or board[i][j] in [1,-1]: | ||
continue | ||
if board[i][k] == board[k][j] == 1: | ||
board[i][j] = 1 | ||
board[j][i] = board[k][i] = board[j][k] = -1 | ||
for i in board: | ||
if i.count(0) == 1: | ||
answer += 1 | ||
return answer | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains hidden or 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 @@ | ||
def main(): | ||
print(solution([2, 1, 3, 2],2)) | ||
|
||
|
||
def solution(priorities, location): | ||
answer = 1 | ||
m = max(priorities) | ||
|
||
while True: | ||
temp = priorities.pop(0) | ||
|
||
if temp == m : | ||
if location == 0: | ||
return answer | ||
answer += 1 | ||
location -= 1 | ||
m = max(priorities) | ||
else: | ||
priorities.append(temp) | ||
if location == 0: | ||
location = len(priorities ) -1 | ||
else: | ||
location -= 1 | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains hidden or 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,16 @@ | ||
def main(): | ||
print(solution([["yellow_hat", "headgear"], ["blue_sunglasses", "eyewear"], ["green_turban", "headgear"]])) | ||
|
||
def solution(clothes): | ||
arr = {} | ||
for c, type in clothes: | ||
arr[type] = arr.get(type, 0) + 1 | ||
|
||
answer = 1 | ||
for type in arr: | ||
answer *= (arr[type] + 1) | ||
|
||
return answer - 1 | ||
|
||
if __name__ == "__main__": | ||
main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[23-02-22] seungyeon.py #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[23-02-22] seungyeon.py #126
Changes from all commits
107049a
d179249
b182096
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.