Skip to content

Conversation

jinvicky
Copy link
Contributor

@jinvicky jinvicky commented Sep 1, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@github-actions github-actions bot added the java label Sep 1, 2025
@jinvicky jinvicky changed the title reverse-linked-list solution [jinvicky] Week7 solution Sep 1, 2025
@hyer0705 hyer0705 self-requested a review September 1, 2025 09:32
Copy link
Contributor

@hyer0705 hyer0705 left a comment

Choose a reason for hiding this comment

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

이번 주도 수고하셨습니다! 에러가 나는 파일은 확인 해주시면 감사하겠습니다.

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.

확인했습니다. 감사합니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

set을 사용해서 슬라이딩 윈도우를 움직일 수 있다는 방법을 알 수 있었습니다. 감사합니다! 저는 while문으로 윈도우의 크기를 가변적으로 변경했는데 이런 방법도 있네요!

}

// dfs는 해당 섬의 넓이를 반환
private int dfsByInt(char[][] grid, boolean[][] visited, int r, int c, int rows, int cols) {
Copy link
Contributor

Choose a reason for hiding this comment

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

섬의 면접 값을 반환하기 위해 반환 값의 타입을 int로 하신건가요? 만약 제가 이해한게 맞다면, 면적 값을 구하는 함수라면 dfsByInt 라는 이름보다는 다름 이름으로 작성하는건 어떨 까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

말씀하신 점이 맞습니다. 이번 dfs 문제 초심자로서 dfsByInt처럼 값을 누적해서 반환하는 경우와 dfs처럼 void 반환 타입으로 호출만 하는 경우를 구분해서 학습하려고 작성했습니다. 그렇다 보니 메서드 가독성이 안 좋아졌네요 하하;; 다음주에는 조언대로 더 이름을 문제에 맞게 개선해보겠습니다. 감사합니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

풀이를 2개를 해주셨군요! 다양한 풀이를 알려주셔서 감사합니다.

@@ -4,6 +4,8 @@ public int uniquePaths(int m, int n) {
* 여기서 이동가능한 경우는 right, down 두가지 경우이다.
* 모든 블록은 내 왼쪽 블록에서 나로 온 경우, 내 위 블록에서 나로 온 경우를 고려해서 [i-1][j] + [i][j-1]로 표현할 수 있다.
* 단 가로 첫번째 줄과 세로 첫번째 줄은 1로 초기화 해줘야 한다. (왜냐하면 각각 down, right이 없기 때문에 그 블록들은 1가지 경우로밖에 도달할 수 없기 때문이다.)
*
*
*/
int[][] dp = new int[m][n];
Copy link
Contributor

Choose a reason for hiding this comment

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

Java에서 배열을 생성할 때, 초기화 값을 넣어 주는 방법이 있을까요? JavaScript에서는 배열을 생성하면서 초기 값을 설정할 수 있는 방법이 있어 궁금해서 질문 남깁니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

자바는 Arrays.fill()로 선언한 배열에 초기화 값을 넣을 수 있습니다.
다만 Arrays.fill()은 조건없이 모든 요소에 주어진 값을 넣어서 초기화하기 때문에 고려하면서 사용하고 있습니다.

또한 이미 선언한 배열을 채우는 것이지 선언과 초기화를 동시에 하지는 못합니다. 감사합니다:)

<예시>
String[] arr = new String[3]; // 배열 먼저 생성
Arrays.fill(arr, "hi"); // 배열 내 모든 요소를 hi로 채움

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.

넵 처음에 도전했다가 안 풀릴 때마다 지피티와 함께 계속 리트코드 내에서 난이도 낮은 문제들을 찾아서 풀고 재도전하는 과정을 반복하고 있습니다. 항상 성공하는 것은 아니지만 이번 문제에서 성공해서 뿌듯했습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

스택, 포인터, 재귀 풀이 방법 모두 공유해주셔서 감사합니다. 주석 덕분에 이해가 쉬웠습니다.

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