Skip to content

Conversation

TonyKim9401
Copy link
Contributor

@TonyKim9401 TonyKim9401 commented Sep 22, 2024

답안 제출 문제

체크 리스트

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

@TonyKim9401 TonyKim9401 changed the title Reverse Linked List [TONY] WEEK 07 Solutions Sep 22, 2024
@YeonguChoe
Copy link
Contributor

이전 주차들에서 토니님 자바 코드가 많이 깔끔한것을 봤습니다.
이번 주차에도 좋은 코드 부탁드립니다. 릿코드 모범 답안이 코드가 다 잘 작성되어있지는 않은것 같더라구요.
토니님이 자바를 잘하시면 릿코드보다 더 좋은 코드를 작성 할수도 있습니다.

@TonyKim9401 TonyKim9401 requested a review from haklee September 23, 2024 22:38
@TonyKim9401 TonyKim9401 marked this pull request as ready for review September 26, 2024 18:30
@TonyKim9401 TonyKim9401 requested a review from a team as a code owner September 26, 2024 18:30
@TonyKim9401 TonyKim9401 requested a review from DaleSeo September 26, 2024 18:30
Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

코드가 참 읽기 편합니다. 😇 복잡도 분석만 좀 더 신경써주시면 금상첨화일 것 같아요!

@@ -0,0 +1,32 @@
// TC: O(n^2)
Copy link
Member

Choose a reason for hiding this comment

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

n이 무엇을 의미하나요?

Copy link
Contributor Author

@TonyKim9401 TonyKim9401 Sep 27, 2024

Choose a reason for hiding this comment

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

@DaleSeo 앗... 정정하겠습니다 TC: O(n * m), n = the size of the matrix, m = the size of the matrix[n]

@@ -0,0 +1,25 @@
// TC: O(n^2)
Copy link
Member

Choose a reason for hiding this comment

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

얼핏 보기에는 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.

@DaleSeo for문이 하나만 사용되었고 주어진 문자열 s만큼 반복을 하기에 얼핏 보면 O(n)으로 보일 수 있는데요, 내부 if문이 true 일 경우 i -= count 가 되면서 최대 O(n^2) 까지 나올 수 있다고 생각합니다! 따라서 최악의 경우 O(n^2) 이 될거라 생각합니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

for문의 index를 for문 내부에서 수정하는데, 이런 용도에는 별도의 변수를 사용해서 for문을 중첩하거나, 첫 for문을 while문으로 수정하면 더 좋을 것 같습니다. 언어에 따라서는 for문의 index가 변경안되거나(capture되어서 별도의 변수로 여겨지는 경우), warning이 뜨거나하는 경우도 있는 것으로 알고 있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lymchgmk 의견 감사합니다!! 다음부터 적용해보도록 하겠습니다 :)

@TonyKim9401 TonyKim9401 requested a review from DaleSeo September 27, 2024 02:22
Copy link
Contributor

@haklee haklee 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 c127512 into DaleStudy:main Sep 27, 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.

5 participants