-
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
[SunaDu] Week 9 #991
[SunaDu] Week 9 #991
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.
파이썬의 min 함수를 사용하여 간단한 풀이를 보여주셨네요!
해당 문제의 키포인트는 어떻게 하면 O(log 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.
키포인트를 놓쳤는데 submit이 통과되어서 혼자 풀었다면 왜 medium이지?하고 놓쳤을 것 같아요
리뷰 감사합니다!!🙌
leetcode-study/find-minimum-in-rotated-sorted-array/dusunax.py
Lines 2 to 10 in 985bf23
# 153. Find Minimum in Rotated Sorted Array | |
> **why binary search works in a "rotated" sorted array?** | |
> rotated sorted array consists of **two sorted subarrays**, and the minimum value is the second sorted subarray's first element. | |
> so 👉 find the point that second sorted subarray starts. | |
> | |
> - if nums[mid] > nums[right]? => the pivot point is in the right half. | |
> - if nums[mid] <= nums[right]? => the pivot point is in the left half. | |
> - loop until left and right are the same. |
leetcode-study/find-minimum-in-rotated-sorted-array/dusunax.py
Lines 29 to 41 in 985bf23
def findMinBS(self, nums: List[int]) -> int: | |
left = 0 | |
right = len(nums) - 1 | |
while left < right: | |
mid = (left + right) // 2 | |
if nums[mid] > nums[right]: | |
left = mid + 1 | |
else: | |
right = mid | |
return nums[left] |
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.
LinkedList의 특성을 잘 살려서 풀이해주신것 같습니다 :)
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.
이번주 2번째로 어려웠던 문제라고 생각되는데요.
dfs 알고리즘을 사용하여 너무나 깔끔하게 풀이해 주신 것 같습니다!
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.
9주차 문제 풀이도 고생 많으셨습니다!
개인적으로 Find minimum in rotated sorted array 문제는 꼭 다시 풀어보셨으면 좋겠어요!
의외로 함정이 숨어있는 문제라고 생각되네요 ㅎㅎ
10주차 문제 풀이도 파이팅입니다!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.