Skip to content

Conversation

eunice-hong
Copy link
Collaborator

✔️ Solution

  1. Part 1: 리스트가 인접 숫자 간 차이가 1에서 3 사이여야 하고, 연속적으로 늘거나 줄어드는지 확인한다.

  2. Part 2: 각 Report 마다 level을 하나씩 뺀 리포트를 재생성하여, Part 1 의 검증 방식을 통과하는 것이 하나라도 있으면 유효하다고 판단한다.

주요 개선 사항:

  • 유효성 검증 로직을 isReportValidisReportValidWithTolerance로 분리하여 가독성 향상.
  • 반복적인 입력 데이터 처리 로직을 parseInput 함수로 추출하여 중복 제거.
  • 리스트의 정렬을 제거하고 zipWithNext를 활용하여 성능을 최적화.

✔️ Reference

  1. Advent of Code 문제 설명: Advent of Code 2024 Day 2 문제 및 예제 참고.

@eunice-hong eunice-hong added the aoc: solution Solution to Advent of Code problems label Dec 2, 2024
@eunice-hong eunice-hong self-assigned this Dec 2, 2024
@eunice-hong eunice-hong requested a review from a team as a code owner December 2, 2024 15:08
@eunice-hong eunice-hong requested review from renardyreveur and removed request for a team December 2, 2024 15:08
Copy link
Collaborator

@renardyreveur renardyreveur left a comment

Choose a reason for hiding this comment

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

👍 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aoc: solution Solution to Advent of Code problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants