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

[환미니니] Week7 문제풀이 #490

Merged
merged 4 commits into from
Sep 30, 2024
Merged

Conversation

JEONGHWANMIN
Copy link
Contributor

@JEONGHWANMIN JEONGHWANMIN commented Sep 23, 2024

답안 제출 문제

체크 리스트

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

@JEONGHWANMIN JEONGHWANMIN self-assigned this Sep 23, 2024
@JEONGHWANMIN JEONGHWANMIN requested a review from a team as a code owner September 23, 2024 16:00
@github-actions github-actions bot added the js label Sep 23, 2024
@JEONGHWANMIN JEONGHWANMIN marked this pull request as draft September 23, 2024 16:01
@JEONGHWANMIN JEONGHWANMIN marked this pull request as ready for review September 28, 2024 16:11
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.

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

const que = [[row,col]]

while (que.length) {
const [row, col] = que.pop()
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분을 볼때, 이름과 동작이 맞지 않는것같아요
queue를 의도하신것같은데, 실제 동작은 stack으로 하고있는 것 같습니다.
결과적으로 bfs라는 함수도 dfs로 동작하고있는것으로 보여요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shift로 했을 때 시간이 초과되어서 pop을 사용해서 풀었는데
다시 풀어봐야겠어요!

let leftIdx = 0;
for (let rightIdx = 0 ; rightIdx < s.length; rightIdx++) {
const char = s[rightIdx]
if (map.has(char) && map.get(char) >= leftIdx) leftIdx = map.get(char) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

중요하지 않은 가독성 관련 의견입니다! 무시하셔도 좋습니다!

이 부분은 핵심 변수인 leftIdx가 변동되는 굉장히 중요한 부분인데, 길게 원라인으로 되어있어 다른 개발자가 읽기 다소 어렵지 않을까 하는 의견입니다!

Copy link
Contributor

@naringst naringst left a comment

Choose a reason for hiding this comment

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

한 주간 고생많으셨습니다! :)

const isValidMove = (grid, n_row, n_col) => {
return n_row >= 0 && n_row < grid.length && n_col >= 0 && n_col < grid[0].length && grid[n_row][n_col] !== '0'
}

Copy link
Contributor

Choose a reason for hiding this comment

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

이렇게 함수를 따로 빼셔서 코드가 엄청 깔끔해진 것 같네요! 저도 다음에 활용해보고 싶네요!

@SamTheKorean SamTheKorean merged commit be3b1fa into DaleStudy:main Sep 30, 2024
1 check passed
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