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

Conversation

@opijae
Copy link
Contributor

@opijae opijae commented Dec 12, 2021

📌 푼 문제들


📝 간단한 풀이 과정

타켓넘버

  • 0 부터 시작해 numbers에 있는 값들을 재귀적으로 더하거나 뺍니다.
  • numbers에 있는 모든 수를 사용해야되니 재귀 들어갈 때 마다 index++를 해주며 numbers 끝에 다 달았는지 확인합니다.
  • index가 끝에 다 달았고 현재 누적합이 목표값이랑 같은지 확인합니다.

짝지어 제거하기

  • 스택을 사용해 다음값과 비교합니다.
  • 스택의 처음 값(제일 나중에 들어온 값)이 다음 문자열이랑 같으면 pop 해줍니다.
  • 설명을 너무 못했는데 애니팡 같은 게임을 생각 하면 쉬울 것 같습니다.

행렬 테두리 회전하기

  • 1 부터 i*j 까지의 행렬을 만들어 줍니다.
  • 쿼리마다 돌면서 범위안에 있는 배열 테두리를 돌려 줍니다.
  • 돌아야 하는 좌표의 순서는 다음과 같습니다.
    0 1 2 3
    9       4
    8 7 6 5
  • 코너마다 다음 봐야할 좌표 방향이 바뀌는 것을 이용했습니다.


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.

수고하셨습니다!

Copy link
Member

Choose a reason for hiding this comment

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

제 코드랑 정말 비슷하네용ㅋㅋㅋ

Copy link
Member

Choose a reason for hiding this comment

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

오.. 문제 유형대로 DFS로 푸셨네요!👍👍 재귀는 항상 어려운 것 같아요ㅠㅠ

Comment on lines +4 to +11
Copy link
Member

Choose a reason for hiding this comment

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

제 코드에 있긴 하지만, 다음처럼 한 줄로도 가능합니다!

mat = [[j * columns + i for i in range(1, columns + 1)] for j in range(rows)]
Comment on lines +37 to +39
Copy link
Member

Choose a reason for hiding this comment

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

저는 아에 새로운 행렬을 만들어줬는데, 이 때는 그냥 temp 변수 선언을 하는 것이 좋을 것 같네요!

Comment on lines +37 to +39
Copy link
Collaborator

@peacecheejecake peacecheejecake Dec 18, 2021

Choose a reason for hiding this comment

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

mat[ni][nj], prev = prev, mat[ni][nj]

이런 식으로도 가능할 것 같습니다!

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.

수고하셨습니다!

Copy link
Member

@bsm8734 bsm8734 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 ecd1bbb into main Dec 19, 2021
@mergify mergify bot deleted the humi-1212 branch December 19, 2021 07:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

5 participants