Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Conversation

@bsm8734
Copy link
Member

@bsm8734 bsm8734 commented Dec 12, 2021

📌 푼 문제들


📝 간단한 풀이 과정

타겟 넘버

  • 모든 경우의 수를 만들어서 계산
  • 비트마스킹을 사용하여, 각 자리수가 1이면 +, 0이면 - 연산을 수행하고, 연산 결과가 타겟 넘버와 같으면, 카운트를 올려준다.

짝지어 제거하기

  • (펭펭님의 도움을 받아 해결!)
  • 문자열을 앞에서 부터 확인
  • 스택이 비었다면, 문자를 push
  • 스택이 비어있지 않다면, 맨 윗 문자와 현재 보고 있는 문자를 비교한다.
    • 같으면 스택을 pop 하고, 다르면 스택에 문자열을 넣는다.

행렬 테두리 회전하기

  • 배열에서의 위치 정보를 pair로 묶어서 큐(1)에 넣고, 배열이 담는 값도 다른 큐(2)에 넣는다.
  • 원형큐에서 한 칸 밀어내는 과정과 같이, 값을 담는 큐의 맨 앞 원소를 큐(2)에서 빼서, 큐(2)의 맨 뒤로 넣어준다.
  • 큐 (1), (2)를 앞에서부터 확인하고, 배열의 위치 정보값과 배열이 담는 값을 매칭시켜가며, 2차원 배열의 값을 업데이트 한다.
  • 위 과정을 거치며, 매 회전마다 최소값을 저장한다.

Copy link
Contributor

@opijae opijae 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
Member

@CoodingPenguin CoodingPenguin left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

Comment on lines +55 to +60
Copy link
Member

Choose a reason for hiding this comment

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

제가 정확히 이해한 건지 모르겠는데, 다음과 같이 이해했는데 맞을가용?

  • 좌표에 해당하는 loc와 그에 해당하는 값 val 2개가 있고
  • loc를 큐라 생각하고 한 번 돌리고 행렬의 각 위치에 그에 대응하는 val을 넣어준다.

예를 들면, loc = [(0, 0), (0, 1), (1, 0), (1, 1)]이고 val = [1, 2, 3, 4] 였을 때 loc = [(1, 1), (0, 0), (1, 0), (0, 1)]로 해주고 mat[1][1] = 1 이런 식으로 바꿔주는 게 맞을까용?

Copy link
Collaborator

@peacecheejecake peacecheejecake left a comment

Choose a reason for hiding this comment

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

수고하셨습나다!

@mergify mergify bot merged commit 3d2a546 into main Dec 18, 2021
@mergify mergify bot deleted the sally-1211 branch December 18, 2021 13:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

5 participants