Skip to content

Conversation

@FEhyoeun
Copy link
Contributor

@FEhyoeun FEhyoeun commented Nov 17, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@Seoya0512 Seoya0512 self-requested a review November 17, 2025 08:47
Copy link
Contributor

@Seoya0512 Seoya0512 left a comment

Choose a reason for hiding this comment

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

안녕하세요, 문제 푸시느라 고생 많으셨습니다😊
저도 타입스크립트로 개발해오던 사람이라 반가운 마음을 가지며 코드 리뷰 진행했습니다.
그럼 다음 주도 화이팅하세요!!

let sObj = {}
let tObj = {}

s.split('').sort().map((sChar) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

sort()메소드를 사용하면 시간 복잡도가 O(n log n)가 된다고 알고 있습니다.
작성해주신 전체 코드에서 마지막 반환값 순서를 보장하기 위해 sort처리를 하신 것 같은데 다른 방법으로 시간복잡도를 개선할 수 있을 것 같아요!

}
})

return JSON.stringify(sObj) === JSON.stringify(tObj)
Copy link
Contributor

Choose a reason for hiding this comment

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

반환할때 JSON.stringify() 는 객체 비교를 위해 사용하고 계신 것 같아요.
해당 부부은 비싼 연산이기 때문에 for-loop를 통해서 key,value를 검증하는 것이 더 낫지 않을까? 라는 생각이 드네요 🤔

// 예시 
for (let key in sObj) {
    if (sObj[key] !== tObj[key]) return false
}

그리고 객체 2개가 아닌 1개를 사용해서 해당 문제를 푸는 방법도 있을 것 같아요 : )

@TonyKim9401 TonyKim9401 merged commit 95be856 into DaleStudy:main Nov 23, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 6기 Nov 23, 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.

4 participants