Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions programmers/약수의 합.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def solution(n):
answer = 0
리스트 = []

for i in range(1, n+1):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

약수는 그 수의 제곱근까지만 확인하면 됨

if n % i == 0:
리스트.append(i)

for i in range(len(리스트)):
answer += 리스트[i]
return answer
12 changes: 12 additions & 0 deletions programmers/짝지어 제거하기.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def solution(s):
리스트 = []

for i in s:
if len(리스트) == 0:
리스트.append(i)
elif i == 리스트[-1]:
리스트.pop()
else:
리스트.append(i)

return int(리스트 == [])
8 changes: 8 additions & 0 deletions programmers/평균 구하기.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def solution(arr):
answer = 0
cnt = 0
for i in range(len(arr)):
Copy link
Collaborator

@LHyunn LHyunn Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for문 안쓰는게 시간복잡도 면에서 이득이지 않냐고 하려다가 sum() / len()도 n인걸 찾아보고는 그냥 거기서 거기구나 하는걸 느꼈음. 괜찮은듯

cnt += arr[i]
answer = cnt / len(arr)

return answer