-
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
Showing
9 changed files
with
114 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,40 @@ | ||
print("10에 계속 modified 표시 뜨는데 좀 무섭네요..") | ||
# print("10에 계속 modified 표시 뜨는데 좀 무섭네요..") #test push | ||
# p.153 | ||
|
||
''' | ||
def solution(prices): | ||
stock_length = len(prices) | ||
result_list = [] | ||
for i in range(prices): | ||
for j in range(i, stock_length): | ||
if i > prices[j]: | ||
result_list[i] = j | ||
continue | ||
return result_list | ||
prices = [1, 2, 3, 2, 3] | ||
print(solution(prices)) | ||
''' | ||
|
||
def solution(prices): | ||
stock_length = len(prices) | ||
result_list = [] | ||
|
||
for i in range(stock_length - 1): | ||
count = 0 | ||
for j in range(i + 1, stock_length): | ||
count += 1 | ||
if prices[i] > prices[j]: | ||
break | ||
result_list.append(count) | ||
|
||
result_list.append(0) | ||
|
||
return result_list | ||
|
||
|
||
prices = [1, 2, 3, 2, 3] | ||
print(solution(prices)) |
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,22 @@ | ||
def solution(board, moves): | ||
popped_shape_cnt = 0 | ||
moved_shape = 0 | ||
start_list = [[] for _ in range(len(board[0]))] | ||
end_list = [] | ||
|
||
for i in range(len(board) - 1, -1, -1): | ||
for j in range(len(board[0])): | ||
if board[i][j]: | ||
start_list[j].append(board[i][j]) | ||
|
||
for k in moves: | ||
if start_list[k - 1]: | ||
moved_shape = start_list[k - 1].pop() | ||
|
||
if end_list and end_list[-1] == moved_shape: | ||
end_list.pop() | ||
popped_shape_cnt += 2 | ||
else: | ||
end_list.append(moved_shape) | ||
|
||
return popped_shape_cnt |
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,12 @@ | ||
# 수정해야 함 | ||
|
||
def solution(n, k, cmd): | ||
result_str = "O" * n | ||
|
||
|
||
for command in cmd: | ||
if command.startwith("Z"): | ||
break | ||
|
||
|
||
return result_str |
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,13 @@ | ||
from collections import deque | ||
|
||
def solution(N, K): | ||
dq = deque(range(1, N + 1)) # 덱으로 1 ~ N + 1까지 번호매겨 deque에 추가 | ||
|
||
while len(dq) > 1: # 최후의 번호가 남을 때까지 반복 | ||
for i in range(K - 1): # k 번째가 가장 앞으로 오도록 | ||
dq.append(dq.popleft()) # 위 주석 내용에 포함되는 라인 | ||
dq.popleft() # k번째 요소 삭제 | ||
|
||
return dq[0] # 마지막 요소 return | ||
|
||
print(solution(5, 2)) |
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 @@ | ||
from collections import deque | ||
|
||
def solution(progresses, speeds): | ||
released_f = [] | ||
day = 0 | ||
count = 0 | ||
|
||
while progresses: | ||
if progresses[0] + day * speeds[0] >= 100: | ||
progresses.pop(0) | ||
speeds.pop(0) | ||
count += 1 | ||
|
||
if not progresses or progresses[0] + day * speeds[0] < 100: | ||
released_f.append(count) | ||
count = 0 | ||
|
||
else: | ||
time +=1 | ||
|
||
return released_f | ||
|
||
|
||
|
||
progresses = [93, 30, 55] | ||
speeds = [1, 30, 5] | ||
print(solution(progresses, speeds)) |
Empty file.
Empty file.
Empty file.
Empty file.