Skip to content

[Joy] Week1 Solutions #20

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 2 commits into from
May 2, 2024
Merged

[Joy] Week1 Solutions #20

merged 2 commits into from
May 2, 2024

Conversation

JoyJaewon
Copy link
Contributor

No description provided.

@dev-jonghoonpark
Copy link
Contributor

마지막 줄에 line break를 추가해주시면 좋을것 같습니다...!
https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

@JoyJaewon
Copy link
Contributor Author

@dev-jonghoonpark
피드백 감사합니다!! 다음 커밋때 반영해보겠습니다🙌

@DaleSeo DaleSeo added this to the week1 milestone Apr 28, 2024
Copy link
Contributor

@Invidam Invidam left a comment

Choose a reason for hiding this comment

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

리뷰 남겼어요!

주석으로 설명 적어주시고, 테스트 케이스들도 적어주시는 꼼꼼함에 놀랐습니다!
(덕분에 릿코드에 테스트 케이스 추가하는 기능 있는 걸 알았어요 ㅎ)

'''

def containsDuplicate(nums):
num_set=set()
Copy link
Contributor

Choose a reason for hiding this comment

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

num_set 처럼 자료형을 변수 명으로 쓰는 것 보다는 의미있는 다른 이름은 어떨까요?

저는 appeared라고 썼어요 ㅎㅎ

Copy link
Member

Choose a reason for hiding this comment

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

재미있는 피드백이네요. 변수 이름 짓기가 항상 어렵죠. 저도 개인적으로 비지니스 로직을 짤 때는 변수 이름에 자료구조를 나타내는 단어를 넣는 것을 피하는 편인데요, 코딩 테스트에서는 오히려 변수에 그런 단어를 넣는 것이 면접관과 의사 소통하기가 편할 때가 있더라고요.

else:
return False

return all(x == 0 for x in count.values())
Copy link
Contributor

Choose a reason for hiding this comment

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

모든 결과가 참이어야 true인 내장 함수인가요? 신기하네요 ㅎㅎ

Copy link
Member

Choose a reason for hiding this comment

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

이 블로그 글을 읽어보시면 호기심이 좀 풀리실 것 같아요: https://www.daleseo.com/python-all/

Comment on lines 25 to 30
print(containsDuplicate([1, 2, 3, 1]) == True)
print(containsDuplicate([1, 2, 3, 4]) == False)

#Edge case
print(containsDuplicate([1]) == False)
print(containsDuplicate([]) == False)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

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.

2문제 남으셨네요. 화이팅! 😄

'''

def containsDuplicate(nums):
num_set=set()
Copy link
Member

Choose a reason for hiding this comment

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

재미있는 피드백이네요. 변수 이름 짓기가 항상 어렵죠. 저도 개인적으로 비지니스 로직을 짤 때는 변수 이름에 자료구조를 나타내는 단어를 넣는 것을 피하는 편인데요, 코딩 테스트에서는 오히려 변수에 그런 단어를 넣는 것이 면접관과 의사 소통하기가 편할 때가 있더라고요.

else:
return False

return all(x == 0 for x in count.values())
Copy link
Member

Choose a reason for hiding this comment

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

이 블로그 글을 읽어보시면 호기심이 좀 풀리실 것 같아요: https://www.daleseo.com/python-all/

Comment on lines 19 to 22
if char in count:
count[char] += 1
else:
count[char] = 1
Copy link
Member

Choose a reason for hiding this comment

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

참고: 요렇게 한 줄로 짜실 수도 있습니다.

Suggested change
if char in count:
count[char] += 1
else:
count[char] = 1
count[char] = count.get(char, 0) + 1

@JoyJaewon JoyJaewon changed the title [Joy] Add solutions for Contains Duplicate, Two Sum, and Valid Anagram [Joy] Week1 Solutions May 1, 2024
Comment on lines +23 to +25
#Version 2
def isPalindrome2(s):
filtered_chars = [c.lower() for c in s if c.isalnum()]
Copy link
Contributor

Choose a reason for hiding this comment

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

V2로 분리하는 것도 좋은 생각이네요!

@JoyJaewon
Copy link
Contributor Author

@DaleSeo @Invidam 다들 피드백 너무 감사합니다🙌

리뷰 남겼어요!

주석으로 설명 적어주시고, 테스트 케이스들도 적어주시는 꼼꼼함에 놀랐습니다! (덕분에 릿코드에 테스트 케이스 추가하는 기능 있는 걸 알았어요 ㅎ)

인터뷰때 바로 코드를 작성하는것보다 주석으로 계획하는 과정 거치고 테스트케이스도 돌려보면서 인터뷰어랑 의사소통하는게 좋다고 해서 연습해봤는데 칭찬 감사합니다!!🥳

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.

수고하셨습니다!

@DaleSeo DaleSeo merged commit 23e262a into DaleStudy:main May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants