Skip to content

Conversation

@robinyoon-dev
Copy link
Contributor

@robinyoon-dev robinyoon-dev commented Nov 17, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@seungriyou seungriyou self-requested a review November 23, 2025 13:34
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.

코드 내에 주석을 잘 작성해주셔서 풀이를 이해하기 쉬웠던 것 같아요!

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

(+ 그리고 문제 풀이 완료 후 PR의 status를 In Review로 바꿔주시면 더 빠른 리뷰가 가능합니당)

tempArray.push(1);
}else{
let tempSum = 0;
tempSum = tempArray[i - 2] + tempArray[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의 변수를 사용해서 공간 복잡도를 한 단계 최적화 할 수 있을 것 같아요~!


//2. sArray와 tArray의 sort를 같게 만든다.
const sortedSArray = sArray.sort();
const sortedTArray = tArray.sort();
Copy link
Contributor

Choose a reason for hiding this comment

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

정렬을 이용해서 풀이하셨네요! 정렬을 하게 되면 시간 복잡도가 O(nlogn)이 되는데요, 카운팅을 이용하면 시간 복잡도를 약간 더 최적화 할 수 있어 이렇게도 한 번 풀어보시는 걸 추천드려요~!

// (지금 보니 이 부분은 zeroCount === 1로 했어도 될 것 같네요...)
tempArray.push(0);
} else {
tempArray.push(totalProduct / nums[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

문제의 without using the division operation 조건이 위배되는 부분인 것 같습니다! prefix sum을 응용해서 풀어보시는 걸 추천드려요~!

var productExceptSelf = function (nums) {

const NUMS_LENGTH = nums.length;
const isZeroArray = []; //boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

O(1) extra space를 사용하라는 follow up 조건을 위해서 isZeroArray 리스트는 제거해도 될 것 같아요~!

for 문 내에서 검사할 때는 nums[i] === 0으로 검사하면 되고, 이미 zeroCount로 전체 0 개수를 알고 있기 때문입니다!

@TonyKim9401 TonyKim9401 merged commit de8ae3d 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.

3 participants