Skip to content
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

[선재] WEEK4 Solution #419

Merged
merged 5 commits into from
Sep 7, 2024
Merged

[선재] WEEK4 Solution #419

merged 5 commits into from
Sep 7, 2024

Conversation

Sunjae95
Copy link
Contributor

@Sunjae95 Sunjae95 commented Sep 3, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@Sunjae95 Sunjae95 self-assigned this Sep 3, 2024
@github-actions github-actions bot added the js label Sep 3, 2024
@Sunjae95 Sunjae95 requested a review from GUMUNYEONG September 3, 2024 08:46
@Sunjae95 Sunjae95 marked this pull request as ready for review September 3, 2024 08:47
@Sunjae95 Sunjae95 requested a review from a team as a code owner September 3, 2024 08:47
@@ -0,0 +1,81 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 문제는 여러방법으로 시도해봤지만 시간초과를 해결하지 못하여 시도방법만 제출합니다.

@DaleSeo
Copy link
Contributor

DaleSeo commented Sep 3, 2024

PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.

위 항목은 체크만 되어 있고 실제로는 안 되어 있는 것 같습니다!

image

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.

안녕하세요 @Sunjae95
자료구조까지 직접 만들어서 하시다니 멋지네요!

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


class CustomQueue {
constructor() {
this.items = new Map();
Copy link
Contributor

Choose a reason for hiding this comment

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

index를 사용해 관리하신다면 Map보다는 Array가 더 효율적이지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

동의합니다.
우선순위큐 자체가 배열의 가장 마지막 인자를 제거하는 로직이라서 Array를 사용하는게 map method를 사용하지 하는것보다 효율적이고 명시적으로 보이네요!

this.heapifyUp();
}

remove() {
Copy link
Contributor

Choose a reason for hiding this comment

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

리턴값이 있다는 점에서 remove보다는 pop이 어떨까 조심스레 의견 드립니다..!!

*/
var longestConsecutive = function (nums) {
const queue = new CustomQueue();
let [count, before, answer] = [0, null, 0];
Copy link
Contributor

Choose a reason for hiding this comment

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

오 구조분해할당을 처음 할당할 때에도 쓰면 좋네요

}
}

class CustomQueue {
Copy link
Contributor

Choose a reason for hiding this comment

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

브레인 스토밍에서 의견주신것처럼 CustomQueue보다는 PriorityQueue 등으로 활용하시는 것이 좀 더 명확할것같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아 요거는 리트코드에서 미리선언되어있어서 참조에러가 나더라구요
아마 있는거 같지만 해당 문서를 찾지 못해서 이름만 바꿔서 구현했어요..😅

let answer = false;
const ROW_LENGTH = board.length;
const COLUMN_LENGTH = board[0].length;
// O(n^2)
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분은, 보드가 정사각형이라는 언급이 없으므로 O(m x n) 등으로 표현해주시는게 좋지 않을까 싶어요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그렇군요! 보통 m x n으로 표현하는지 몰랐는데 알게됐네요 감사합니다!

@Sunjae95 Sunjae95 merged commit d8b4c28 into DaleStudy:main Sep 7, 2024
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