Skip to content

[phenomenal_star_75309] #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 15, 2024
Merged

[phenomenal_star_75309] #677

merged 9 commits into from
Dec 15, 2024

Conversation

suhacs
Copy link
Contributor

@suhacs suhacs commented Dec 11, 2024

답안 제출 문제

체크 리스트

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

@suhacs suhacs requested a review from a team as a code owner December 11, 2024 03:49
@github-actions github-actions bot added the js label Dec 11, 2024
@suhacs
Copy link
Contributor Author

suhacs commented Dec 11, 2024

파일명(suhacs.js)과 제 GitHub 아이디를 통일했는데 왜 계속 오류가 뜨는걸까요ㅜㅜ

@HC-kang
Copy link
Contributor

HC-kang commented Dec 11, 2024

안녕하세요 @suhacs 님!
아래 링크를 확인해 주세요!

#664 (comment)

@suhacs suhacs closed this Dec 11, 2024
@suhacs suhacs reopened this Dec 11, 2024
@suhacs suhacs requested a review from YeomChaeeun December 11, 2024 21:54
@suhacs
Copy link
Contributor Author

suhacs commented Dec 11, 2024

안녕하세요 @suhacs 님! 아래 링크를 확인해 주세요!

#664 (comment)

해결됐습니다. 감사합니다~!

Copy link
Contributor

@HC-kang HC-kang left a comment

Choose a reason for hiding this comment

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

@suhacs 님 첫주 고생하셨습니다.
다만 풀이가 누락된 부분이 있는 것 같아요. 해당 내용 수정해주시면 다시 확인하겠습니다!

const numLength = nums.length;
return numLength === setLength ? false : true;
}
console.log(containsDuplicate([1, 1, 1, 3, 3, 4, 3, 2, 4, 2]));
Copy link
Contributor

Choose a reason for hiding this comment

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

제출시에는 확인을 위한 로그는 제거해주시는게 좋을 것 같아요! 🧹

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 알겠습니다 !!

function containsDuplicate(nums) {
const setLength = [...new Set(nums)].length;
const numLength = nums.length;
return numLength === setLength ? false : true;
Copy link
Contributor

Choose a reason for hiding this comment

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

2line: new Set(nums).size !== nums.length
4line: numLength !== setLength

이후로도 더 간략화 할 수 있어 보이는데, 혹시 시간이 가능하시다면 한번 해보시는건 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function containDuplicate2(nums) {
return nums.length !== new Set(nums).size;
}

이렇게 하니까 더 간단해지네요..!!!피드백 감사합니다~~!

element_qty.push({ [num]: count });
}
Object.keys(element_qty).forEach((key) => element_qty[key]);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

풀이의 일부가 누락된 것 같아요. 혹시 다시 확인 해 주실 수 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

회사에서 시간날때 풀다가, 집에서 마저 풀려고 커밋 해놓은건데 미완성인 상태로 올려버렸네요. 다음부터 유의하겠습니다 !

function isValidPalindrome(text) {
let refinedTxt = text
.replaceAll(/[^a-zA-Z0-9]/g, "")
.replaceAll(" ", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

.replaceAll(/[^a-zA-Z0-9]/g, "")에서 이미 충분하게 replaceAll(" ", "")까지 처리될것으로 보여요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 피드백 감사합니다 !!

.replaceAll(/[^a-zA-Z0-9]/g, "")
.replaceAll(" ", "")
.toLowerCase();
console.log(refinedTxt === [...refinedTxt].reverse().join("") ? true : false);
Copy link
Contributor

Choose a reason for hiding this comment

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

불필요한 로그네요! 🧹

.replaceAll(" ", "")
.toLowerCase();
console.log(refinedTxt === [...refinedTxt].reverse().join("") ? true : false);
return refinedTxt === [...refinedTxt].reverse().join("") ? true : false;
Copy link
Contributor

Choose a reason for hiding this comment

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

return refinedTxt === [...refinedTxt].reverse().join("")로 충분해 보입니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아 그렇네요 감사합니다 !!

@SamTheKorean SamTheKorean merged commit 1d1797c into DaleStudy:main Dec 15, 2024
1 check passed
@suhacs
Copy link
Contributor Author

suhacs commented Dec 16, 2024

@suhacs 님 첫주 고생하셨습니다. 다만 풀이가 누락된 부분이 있는 것 같아요. 해당 내용 수정해주시면 다시 확인하겠습니다!

네 문제풀이 다음과 같이 완료하였습니다!!

function top_k_frequent_element(numArr, k) {
let element_qty = [];
const numSet = [...new Set(numArr)];
for (num of numSet) {
const count = numArr.filter((x) => x === num).length;
element_qty.push({ [num]: count });
}
Object.keys(element_qty).forEach((key) => element_qty[key]);

const sortedArray = element_qty.sort((a, b) => {
const valueA = Object.values(a)[0];
const valueB = Object.values(b)[0];
return valueB - valueA;
});

const topKeys = sortedArray.slice(0, k).map((obj) => Object.keys(obj)[0]);
return topKeys;
}

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