Skip to content

Conversation

delight010
Copy link
Contributor

@delight010 delight010 commented Oct 3, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@delight010 delight010 moved this from Solving to In Review in 리트코드 스터디 5기 Oct 3, 2025
Copy link
Contributor

@yhkee0404 yhkee0404 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 +18 to +19
if intervals[i][0] >= currentInterval[0] && intervals[i][0] <= currentInterval[1] {
currentInterval = [currentInterval[0], max(currentInterval[1], intervals[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.

Suggested change
if intervals[i][0] >= currentInterval[0] && intervals[i][0] <= currentInterval[1] {
currentInterval = [currentInterval[0], max(currentInterval[1], intervals[i][1])]
if intervals[i][0] <= currentInterval[1] {
currentInterval[1] = intervals[i][1]

[0] 기준으로 정렬한 상태에서 intervals[i][0] >= currentInterval[0]은 항상 참일 것 같아요.
왜냐하면 currentInterval = intervals[j]라고 하면 j <= i이므로 intervals[i][0] >= intervals[j][0]가 참이기 때문이에요.
또한 max 연산도 생략 가능해 보입니다.

Comment on lines +13 to +23
guard let head = head, head.next != nil, head.next?.next != nil else {
return
}

var slow = head
var fast = head

while fast.next != nil && fast.next?.next != nil {
slow = slow.next!
fast = fast.next!.next!
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional Chaining 대신 이렇게 쓸 수도 있겠네요

Suggested change
guard let head = head, head.next != nil, head.next?.next != nil else {
return
}
var slow = head
var fast = head
while fast.next != nil && fast.next?.next != nil {
slow = slow.next!
fast = fast.next!.next!
}
guard let head = head, let first = head.next, let second = first.next else {
return
}
var slow = head
var fast = head
while true {
guard let first = fast.next, let second = first.next else {
break
}
slow = slow.next!
fast = second
}

@TonyKim9401 TonyKim9401 merged commit e24e48b into DaleStudy:main Oct 5, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants