Skip to content

[Week14] PGS 92343: 양과늑대#89

Merged
sukangpunch merged 1 commit intomainfrom
sukangpunch
Apr 7, 2026
Merged

[Week14] PGS 92343: 양과늑대#89
sukangpunch merged 1 commit intomainfrom
sukangpunch

Conversation

@sukangpunch
Copy link
Copy Markdown
Contributor

@sukangpunch sukangpunch commented Apr 7, 2026

문제 정보

풀이 방법

간단히 어떤 방식으로 풀었는지 설명해주세요.

 * 어려워서 ai 활용
 * ArrayList로 이진 트리를 구성하여, 해당 노드의 자식들을 간편하게 접근할 수 있도록 함.
 * backtrack 내부에선 currentIdx 를 기반으로 양인지, 늑대인지 구분하고 값을 증가시킨다.
 * 만약 늑대가 더 많아진다면 가지치기(return)
 * 그 다음 result를 업데이트(양 개수)
 * 다음 탐색은 현재 노드 기반 자식 노드들을 찾고, 찾은 자식들에 대해 백트래킹을 진행
 * 현재 가능한 방향으로만 backtrack 함수를 호출하기 때문에 visited 배열 불필요

체크리스트

  • 코드가 정상적으로 실행되나요?
  • 커밋 메시지가 컨벤션을 따르나요?
  • 파일명이 올바른가요? ({닉네임}.{확장자})

추가 코멘트

(선택사항) 추가로 공유하고 싶은 내용이 있다면 작성해주세요.

@sukangpunch sukangpunch self-assigned this Apr 7, 2026
@github-actions github-actions bot added weekly-challenge 주차별 공통 문제 프로그래머스 프로그래머스 문제 labels Apr 7, 2026
@sukangpunch sukangpunch merged commit a6b78cd into main Apr 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

weekly-challenge 주차별 공통 문제 프로그래머스 프로그래머스 문제

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant