Skip to content

Conversation

EcoFriendlyAppleSu
Copy link
Contributor

@EcoFriendlyAppleSu EcoFriendlyAppleSu commented Jan 14, 2025

답안 제출 문제

체크 리스트

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

Copy link
Contributor

@mmyeon mmyeon left a comment

Choose a reason for hiding this comment

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

안녕하세요 반갑습니다!
풀이 진행중이셔서 리뷰 살짝 남기고 갑니다 😄
리뷰하면서 많이 배워갑니다~~
남은 문제도 모두 파이팅입니다 !!

Comment on lines +15 to +26
if (element == ')' || element == ']' || element == '}') {
if (stack.isEmpty()) {
return false
} else if (stack.last() == '(' && element == ')') {
stack.removeAt(stack.lastIndex)
} else if (stack.last() == '[' && element == ']') {
stack.removeAt(stack.lastIndex)
} else if (stack.last() == '{' && element == '}') {
stack.removeAt(stack.lastIndex)
} else {
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

괄호 짝인지 비교한 뒤 stack에서 제거 하는 로직이 반복되고 있어서,
괄호 짝을 객체나 Map에 정의한 뒤 키 값에 대응하는 값을 찾으면 중첩을 좀 더 줄일 수 있을 것 같아요
코틀린이 낯설어서 자바스크립트 코드 예시 첨부합니다 ~

  const matchingBrackets: Record<string, string> = {
    ")": "(",
    "}": "{",
    "]": "[",
  };

Copy link
Contributor

Choose a reason for hiding this comment

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

주석이 꼼꼼히 작성되어 있어서 리뷰하는 데 큰 도움이 되었어요.
더 나은 방법 찾으시는 모습이 멋지네요! 😃

Comment on lines +43 to +58
fun maxArea02(height: IntArray): Int {
var maxValue = 0
var left = 0
var right = height.size - 1
while (left <= right) {
val width = right - left
val containerHeight = Math.min(height[left], height[right])
val area = width * containerHeight
maxValue = Math.max(maxValue, area)
if (height[left] < height[right]) {
left++
} else {
right--
}
}
return maxValue
Copy link
Contributor

Choose a reason for hiding this comment

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

로직 멋지네요! 깔끔하고 좋아요 👍

* https://www.youtube.com/watch?v=TohdsR58i3Q 동영상 참조
* trie 알고리즘을 사용한 문제 해결
* 시간 복잡도: O(L * 26)
* -> addWord() 의 경우, 각 노드는 최대 26개의 노드를 가질 수 있으며 단어의 길이가 L이라면 O(L)의 시간 소요: O(L)
Copy link
Contributor

Choose a reason for hiding this comment

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

오! Trie 한 노드에서 가능한 자식 노드는 알파벳 개수 최대 26개로 제한되는군요!
중복된 알파벳은 기존 노드 재활용한다는 점 덕분에 새로 배워갑니다!
알려주셔서 감사합니다 👍

Copy link
Contributor

@TonyKim9401 TonyKim9401 left a comment

Choose a reason for hiding this comment

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

6주차 문제 풀이 고생 많으셨습니다!
7주차도 파이팅입니다!

@EcoFriendlyAppleSu EcoFriendlyAppleSu merged commit f39ef72 into DaleStudy:main Jan 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants