Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tony] WEEK 14 Solutions #592

Merged
merged 4 commits into from
Nov 17, 2024
Merged

[Tony] WEEK 14 Solutions #592

merged 4 commits into from
Nov 17, 2024

Conversation

TonyKim9401
Copy link
Contributor

@TonyKim9401 TonyKim9401 commented Nov 12, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@@ -0,0 +1,14 @@
public class Solution {
public int reverseBits(int n) {
// time complexity O(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

엇 time complexity가 O(N) 아닌가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for문의 반복 횟수가 Integer.SIZE = 32 로 고정되니 O(1) 이라고 생각했는데 아닐까요!?

Copy link
Contributor

Choose a reason for hiding this comment

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

오 맞네요 제가 생각이 짧았습니다 ㅎㅎㅎ

class Solution {
private List<List<Integer>> output = new ArrayList<>();
public List<List<Integer>> levelOrder(TreeNode root) {
dsf(0, root);
Copy link
Contributor

Choose a reason for hiding this comment

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

(완전완전 사소한 typo) dsf -> dfs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이런... 수정해두겠습니다 ㅠ 오타가 제일 무서워요

return output;
}

private void dsf(int level, TreeNode node) {
Copy link
Contributor

Choose a reason for hiding this comment

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

문제를 보고 저는 자연스레 BFS가 떠올라서 BFS로 풀이했는데, 이렇게 DFS로 풀이할 수도 있군요 ㅎㅎ
잘 봤습니다 👍👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

앗 저는 DFS밖에 생각이 안나서 ㅋㅋㅋ
Flynn님 풀이 보고 BFS 공부하겠습니다!

@TonyKim9401 TonyKim9401 marked this pull request as ready for review November 16, 2024 01:29
@TonyKim9401 TonyKim9401 requested a review from a team as a code owner November 16, 2024 01:29
@TonyKim9401 TonyKim9401 requested a review from obzva November 16, 2024 03:00
Copy link
Contributor

@obzva obzva left a comment

Choose a reason for hiding this comment

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

토니님 한 주 수고하셨습니다 :)

@TonyKim9401 TonyKim9401 merged commit 187e613 into DaleStudy:main Nov 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants