Skip to content

Conversation

@changhyumm
Copy link
Contributor

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

Copy link
Contributor

@seungriyou seungriyou left a comment

Choose a reason for hiding this comment

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

이번 한 주도 수고 많으셨습니다~~! 🦾

l += 1
r -= 1
return list(ans_set)

Copy link
Contributor

Choose a reason for hiding this comment

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

파일 마지막에 빈 개행이 한 줄만 들어가도록 수정 부탁드립니다~!

answer = []
for k in range(len(left)):
answer.append(left[k]*right[k])
return answer No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

merge를 위해 파일 마지막에 빈 개행 추가 부탁드립니다!



## 투포인터 활용
# sort + loop -> O(nlogn)
Copy link
Contributor

Choose a reason for hiding this comment

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

sort + 이중 loop이므로 시간 복잡도가 O(n^2)이 될 것 같습니다!

r -= 1
else:
# 중복제거
ans_set.add((nums[i], nums[l], nums[r]))
Copy link
Contributor

Choose a reason for hiding this comment

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

set을 활용해 중복 제거를 하셨네요! 저는 포인터 기반으로 루프 내에서 중복을 제거하도록 풀어봤었는데, 이렇게 하면 set을 유지하기 위한 추가적인 공간 복잡도를 최적화 할 수 있더라구요! 한 번 포인터 기반으로도 풀어보시는 걸 추천드립니다~~ 🤩

dp[1] = 2

for i in range(2, n):
dp[i] = dp[i-2] + dp[i-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

이렇게 DP 테이블의 가장 최근 n개의 원소만 사용하는 경우에는 O(n) space의 DP 테이블 대신 O(1)space의 변수를 사용해서 공간 복잡도를 한 단계 최적화 할 수 있을 것 같아요~!

else:
return False
# 시간복잡도 O(n)
# 공간복잡도 O(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

저도 다시 풀어보면서 알게 된 사실인데요, 이 문제에서는 입력값이 모두 영어 소문자로만 구성되어 있으므로 공간 복잡도가 O(26) = O(1)이 된다고 합니다!

for char in t:
if char in counter and counter[char] != 0:
counter[char] -= 1
elif char in counter and counter[char] == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

if-elif 문에서 char in counter 확인 로직이 중복되므로 이를 분리한다면 코드가 조금 더 단순해질 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants