Skip to content

[shinsj4653] Week 13 Solutions #1609

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions find-median-from-data-stream/shinsj4653.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
[문제풀이]
# Inputs
# Outputs
# Constraints
# Ideas
[회고]
"""


16 changes: 16 additions & 0 deletions insert-interval/shinsj4653.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
[문제풀이]
# Inputs

# Outputs

# Constraints

# Ideas

[회고]

"""



15 changes: 15 additions & 0 deletions kth-smallest-element-in-a-bst/shinsj4653.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
[문제풀이]
# Inputs
# Outputs
# Constraints
# Ideas
[회고]
"""


15 changes: 15 additions & 0 deletions lowest-common-ancestor-of-a-binary-search-tree/shinsj4653.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
[문제풀이]
# Inputs
# Outputs
# Constraints
# Ideas
[회고]
"""


43 changes: 43 additions & 0 deletions meeting-rooms/shinsj4653.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
[문제풀이]
# Inputs
[(0, 8), (8, 10)] -> 튜플 배열

# Outputs
모든 미팅 시간에 대해 참여할 수 있는지에 대한 여부

# Constraints
0 <= intervals 배열 <= 10^4
구간 길이 : 2


# Ideas
정렬 후 각 요소 순회히면서, 첫번째 오른쪽 값보다 두번째 왼쪽 값이 크거나 같으면 통과
아니면 false?

[회고]

"""


class Solution:
"""
@param intervals: an array of meeting time intervals
@return: if a person could attend all meetings
"""

def can_attend_meetings(self, intervals: List[Interval]) -> bool:
# Write your code here

intervals.sort(key=lambda x: (x[0]))
Copy link
Contributor

Choose a reason for hiding this comment

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

괄호 없이 x[0]만 써도 충분해요

for i in range(len(intervals) - 1):
Copy link
Contributor

Choose a reason for hiding this comment

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

range 대신 zip 사용 시 더 파이썬답게 표현 가능 할 것 같아요. 저도 range를 더 자주 쓰긴 하지만요 ㅎㅎ

if intervals[i][1] > intervals[i + 1][0]:
return False

return True


# 해설
# 제출 코드와 동일!