Skip to content

[Leo] 7th Week solutions #135

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
Jun 16, 2024
Merged

[Leo] 7th Week solutions #135

merged 2 commits into from
Jun 16, 2024

Conversation

leokim0922
Copy link
Contributor

No description provided.

@leokim0922 leokim0922 marked this pull request as draft June 14, 2024 22:30
@leokim0922 leokim0922 marked this pull request as ready for review June 15, 2024 07:18
@yolophg yolophg self-requested a review June 15, 2024 16:58
@yolophg
Copy link
Contributor

yolophg commented Jun 15, 2024

파이썬은 제게 생소함에도 불구하고, 코드를 읽는데 편안하고 어렵지 않았습니다.
랭귀지는 달라도 전체적인 알고리즘 풀이 패턴은 결국 비슷해서 그런 영향도 있나봅니다 😀
수고 많으셨습니다 :)

@@ -0,0 +1,12 @@
class Solution:
def isValidBST(self, root: Optional[TreeNode]) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

Typescript 처럼, 반환 타입을 지정할 수 있는 코드들이 흥미로웠습니다.
확실히 타입을 지정하니 가독성도 올라가고 훨씬 좋네요!

for i in range(n):
right = right.next

if not right: return head.next
Copy link
Contributor

Choose a reason for hiding this comment

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

JS와 다르게 아주 간단히 not 연산자만으로 조건을 확인하고 반환할 수 있다는 점이 좋네요!

Comment on lines +3 to +8
def helper(node, low, high):
if not node:
return True
if not (low < node.val < high):
return False
return helper(node.left, low, node.val) and helper(node.right, node.val, high)
Copy link
Contributor

@yolophg yolophg Jun 15, 2024

Choose a reason for hiding this comment

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

helper 함수를 활용하여 모듈화를 하신 점, 너무 좋은 것 같습니다!

@leokim0922 leokim0922 merged commit d0eae9b into DaleStudy:main Jun 16, 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.

2 participants