Skip to content

Commit

Permalink
여러분 해시는 뭘까요?..
Browse files Browse the repository at this point in the history
  • Loading branch information
pigmal24 committed Aug 31, 2024
1 parent 8ab11b2 commit bdee831
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 1 deletion.
41 changes: 40 additions & 1 deletion YWCHOI/11to20/12.py
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))
22 changes: 22 additions & 0 deletions YWCHOI/11to20/13.py
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
12 changes: 12 additions & 0 deletions YWCHOI/11to20/14.py
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
13 changes: 13 additions & 0 deletions YWCHOI/11to20/15.py
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))
27 changes: 27 additions & 0 deletions YWCHOI/11to20/16.py
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 added YWCHOI/11to20/17.py
Empty file.
Empty file added YWCHOI/11to20/18.py
Empty file.
Empty file added YWCHOI/11to20/19.py
Empty file.
Empty file added YWCHOI/11to20/20.py
Empty file.

0 comments on commit bdee831

Please sign in to comment.