-
Notifications
You must be signed in to change notification settings - Fork 126
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 07 Solutions #485
Conversation
이전 주차들에서 토니님 자바 코드가 많이 깔끔한것을 봤습니다. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n
이 무엇을 의미하나요?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
얼핏 보기에는 O(n)
솔루션 같은데, 시간 복잡도 설명 좀 부탁드리겠습니다.
There was a problem hiding this comment.
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)
이 될거라 생각합니다.
There was a problem hiding this comment.
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이 뜨거나하는 경우도 있는 것으로 알고 있습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lymchgmk 의견 감사합니다!! 다음부터 적용해보도록 하겠습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깔끔한 풀이들 멋집니다! 수고 많으셨습니다!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.