Skip to content

[이유진] Week1 #674

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

Merged
merged 4 commits into from
Dec 14, 2024
Merged

[이유진] Week1 #674

merged 4 commits into from
Dec 14, 2024

Conversation

Real-Reason
Copy link
Contributor

@Real-Reason Real-Reason commented Dec 10, 2024

답안 제출 문제

체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@Real-Reason Real-Reason self-assigned this Dec 10, 2024
@Real-Reason Real-Reason requested a review from a team as a code owner December 10, 2024 17:19
@obzva
Copy link
Contributor

obzva commented Dec 11, 2024

@Real-Reason 혹시 풀려고 했던 문제들을 모두 푼 상태이신가요?
in review상태인데 체크리스트와 답안 제출상태의 체크 박스는 아닌 것 같아 질문 드립니다 ㅎㅎ

@Real-Reason
Copy link
Contributor Author

@Real-Reason 혹시 풀려고 했던 문제들을 모두 푼 상태이신가요? in review상태인데 체크리스트와 답안 제출상태의 체크 박스는 아닌 것 같아 질문 드립니다 ㅎㅎ

아, 이번주는 체크된 문제들까지 풀려고 했습니다 :)
제 의도라면 주석처리가 되어야하는군요~ 수정했습니다! 감사합니다 ☺️

class SolutionContainsDuplicate {
fun containsDuplicate(nums: IntArray): Boolean {
val size = nums.size
val numsToSet = nums.toSet()
Copy link
Contributor

Choose a reason for hiding this comment

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

안녕하세요 ^^
이 부분은 Set으로 중복 값을 제거하신거군요!
풀이가 간결해서 좋아보입니다 👍

cnt++
}
else if (nums[i - 1] == nums[i]) {
return@forEachIndexed
Copy link
Contributor

Choose a reason for hiding this comment

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

제가 kotlin 을 잘 몰라서 질문드립니다 😅 이 부분은 어떠한 작업인가요?
인덱스를 건너뛰는 작업인걸가요? ^^

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
Contributor Author

Choose a reason for hiding this comment

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

forEach 문으로 return 해줍니다~
말씀해주신대로 해당 인덱스를 건너뛰는 의도로 작성했습니다 :)

var startIndex = 0
var endIndex = sToCharArray.size - 1
while (startIndex < endIndex) {
if (!sToCharArray[startIndex].isLetterOrDigit() || sToCharArray[startIndex].isWhitespace()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분은 글자 부분인지 확인하는 if문으로 보이는데요~
앞단에서 특수문자, 공백을 제거하는것도 좋을것 같습니다! ^^

Copy link
Member

Choose a reason for hiding this comment

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

흠... 🤔 코드는 좀 더 복잡해도 저는 현재 방법이 더 효율적일 수 있다는 생각이 들어요. 앞단에서 특수문자, 공백을 제거하려면 입력 문자열을 2번 스캔해야하니까요. 물론 대세(빅오 표현법 상으로는)에는 지장이 없겠지만요 😄

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.

오늘 1주차 마감일이고 목표로 하신 4문제를 다 잘 푸신 것 같아서 PR 병합이 가능하시도록 우선 승인을 해드리겠습니다!

@Real-Reason Real-Reason merged commit f54a05d into DaleStudy:main Dec 14, 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.

4 participants