Skip to content

Conversation

std-freejia
Copy link
Contributor

@std-freejia std-freejia commented Jul 30, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@std-freejia std-freejia moved this from Solving to In Review in 리트코드 스터디 5기 Aug 2, 2025
@std-freejia
Copy link
Contributor Author

안녕하세요 @hj4645 님! 리뷰 부탁드려도 될까요 😀

@std-freejia std-freejia requested a review from TonyKim9401 August 2, 2025 14:03
@std-freejia
Copy link
Contributor Author

안녕하세요 스터디 리더 @TonyKim9401 님! 😀 혹시 리뷰 부탁드려도 될까요? 감사합니다.

Copy link
Contributor

@hj4645 hj4645 left a comment

Choose a reason for hiding this comment

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

저도 요 문제(climbing stairs) 비슷하게 풀었는데, 리트코드 풀이들 보다보니 공간 복잡도를 줄이기 위해 배열 대신 마지막 두 값을 저장하는 변수를 사용하는 방법도 있더라구요!

Copy link
Contributor

@hj4645 hj4645 Aug 2, 2025

Choose a reason for hiding this comment

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

이 문제는 맵을 하나만 선언해서 count를 빼주는 방식으로 풀었었는데, 2개를 선언해서 equals로 푸는 방법도 가독성 면에서 좋은 것 같습니다
2주차도 수고 많으셨습니다!😆
리뷰가 늦어 죄송합니다🥲

Map<Character, Integer> map = new HashMap<>();

        // s의 문자로 카운트 증가
        for (char c : s.toCharArray()) {
            map.put(c, map.getOrDefault(c, 0) + 1);
        }

        // t의 문자로 카운트 감소
        for (char c : t.toCharArray()) {
            int count = map.getOrDefault(c, 0);
            if (count == 0) { // t에만 있는 문자가 있거나, 같은 문자가 더 많으면
                return false;
            }
            map.put(c, count - 1);
        }
        return true;

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

3 participants