Skip to content

[jangwonyoon] WEEK04 solutions #1835

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 5 commits into from
Aug 17, 2025
Merged

[jangwonyoon] WEEK04 solutions #1835

merged 5 commits into from
Aug 17, 2025

Conversation

jangwonyoon
Copy link
Contributor

@jangwonyoon jangwonyoon commented Aug 17, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@jangwonyoon jangwonyoon self-assigned this Aug 17, 2025
@github-actions github-actions bot added the js label Aug 17, 2025
@jangwonyoon jangwonyoon changed the title [weeks 4 ] [jangwonyoon] WEEK04 solutions Aug 17, 2025
@jangwonyoon jangwonyoon moved this from Solving to In Review in 리트코드 스터디 5기 Aug 17, 2025
@seungriyou seungriyou self-requested a review August 17, 2025 09:54
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.

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

- n: list1의 길이, m: list2의 길이

* 공간 복잡도(SC): O(n + m)
- 재귀 호출 시 스택 메모리가 최대 n+m 깊이까지 쌓일 수 있음
Copy link
Contributor

Choose a reason for hiding this comment

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

적어두신 것처럼 재귀로 풀면 콜 스택으로 인해 공간 복잡도가 O(n + m)이 됩니다! 그래서 저는 링크드리스트 문제는 반복문으로도 한 번 더 풀어보는 편인데요, 코드가 조금 더 복잡해지기는 하지만 공간 복잡도를 O(1)으로 줄일 수 있기 때문입니다. 여유가 되신다면 반복문으로도 풀어보시는 걸 추천드려요~!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오오 감사합니다!! 반복문으로더 풀어볼게요

*
* 문제 풀이 방법:
* 1. 배열을 이진 탐색으로 탐색
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

각 풀이별로 복잡도 분석과 풀이법을 정리해주셔서 리뷰어 입장에서도 이해가 쉬웠고, 풀이하시는 과정에서도 공부가 많이 되셨을 것 같습니다!

// 2) 가드: 범위/문자/방문 상태 확인
if (r < 0 || r >= rows || c < 0 || c >= cols) return false;
if (board[r][c] !== word[idx]) return false;
if (board[r][c] === '#') return false; // 이미 방문했으면 탈락
Copy link
Contributor

Choose a reason for hiding this comment

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

저는 주로 dfs에서 조건을 확인할 때 여러 조건들을 모두 or로 연결하곤 했었는데요, 각 조건이 각각 라인별로 적혀있으니 오히려 훨씬 가독성도 좋고 디버깅하기가 쉬워보이네요! 덕분에 배워갑니다~!

@jangwonyoon jangwonyoon merged commit e5fe6dd into DaleStudy:main Aug 17, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Aug 17, 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.

2 participants