Skip to content
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

[Week20] 이예지 - 4문제 완료 #90

Merged
merged 4 commits into from
Jan 12, 2025
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
13 changes: 13 additions & 0 deletions oyatplum/Week20/같은 숫자는 싫어.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def solution(arr):
answer = []
for i in arr:
if len(answer) == 0:
answer.append(i)
else:
k = answer.pop()
if i == k:
answer.append(i)
else:
answer.append(k)
answer.append(i)
return answer
22 changes: 22 additions & 0 deletions oyatplum/Week20/기능 개발.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
answer = []

def solution(progresses, speeds):
global answer
num = 0
while progresses[0] < 100:
for i, (j,k) in enumerate(zip(progresses, speeds)):
progresses[i] = j + k

for i in progresses[:]:
if i >= 100:
progresses.pop(0)
speeds.pop(0)
num += 1
else:
break
answer.append(num)

if len(progresses) == 0:
return answer
else:
return solution(progresses, speeds)
18 changes: 18 additions & 0 deletions oyatplum/Week20/올바른 괄호.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from collections import deque

def solution(s):
queue = deque()
for i in s:
if len(queue) == 0:
queue.append(i)
else:
temp = queue.pop()
if temp == "(" and i == ")":
continue
else:
queue.append(temp)
queue.append(i)
if len(queue) == 0:
return True
else:
return False
21 changes: 21 additions & 0 deletions oyatplum/Week20/입국 심사.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def solution(n, times):
total = 0
left = 1
right = max(times) * n

while left <= right:
mid = (left + right) // 2
people = 0

for time in times:
people += mid // time
if people >= n:
break

if people >= n :
total = mid
right = mid -1
elif people < n :
left = mid + 1

return total