File tree Expand file tree Collapse file tree 7 files changed +129
-3
lines changed
container-with-most-water
find-minimum-in-rotated-sorted-array
longest-repeating-character-replacement
longest-substring-without-repeating-characters
search-in-rotated-sorted-array Expand file tree Collapse file tree 7 files changed +129
-3
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,27 @@ $ git push origin main
4949
5050확인이 되었으면, ` Create pull request ` 를 누르고, ` Title ` 에 ** 본인의 디스코드 닉네임을 포함 시켜주고** ` Create pull request ` 버튼을 클릭합니다.
5151
52- 그러면 디스코드에도 알림이 올겁니다.
52+ 그러면 디스코드에도 알림이 올겁니다. ` Pull Request ` 를 생성한 뒤, 우측 ` Project ` 탭에서 ` Iteration ` 설정을 현재 진행 주차에 맞춰주시기 바랍니다.
5353
54- 이제 본인이 작성한 솔루션을 리뷰 받을 수 있습니다. 리뷰가 ` approved ` 된다면 메인 저장소를 ` Merge ` 하실 수 있습니다.
54+ 또한 ` Draft PR ` 기능을 활용해 한 번에 모든 솔루션을 제출하기보다 본인의 진행 상황을 주기적으로 업데이트할 수 있도록 합니다.
55+
56+ ` Draft ` 변환은 ` Pull Request ` 생성 후 우측 상단 ` Still in progress? ` 항목을 통해 변환할 수 있습니다.
57+
58+ 이제 본인이 작성한 솔루션을 리뷰받을 수 있습니다. 리뷰가 ` approved ` 된다면 메인 저장소에 ` Merge ` 하실 수 있습니다.
59+
60+ Pull Request 설명란에 문제를 해결하면서 어려웠던 부분이나 도움이 필요한 부분에 대해 남겨주시면 다른 분들이 리뷰할 때 참고할 수 있어서 좋겠죠?
61+
62+ Pull Request에 대한 모든 프로세스가 완료되었다면, 본인의 Pull Request는 Pull Request 하단 ` Merge pull request ` 버튼을 클릭하여
63+
64+ 직접 ` Merge ` 진행하도록 합니다.
65+
66+ ## PR 답안 코드 리뷰법
67+
68+ 본인의 Pull Request 작성 완료 후, 본인 직후 Pull Request를 생성한 스터디원의 솔루션을 리뷰합니다. 예를들어,
69+
70+ ![ 예시] ( images/337985716-307fdf57-90a7-4ccb-ab03-99a2d96fdc39.png )
71+
72+ 위 형식으로 리뷰를 진행합니다. 리뷰 내용은 당시까지 제출 완료된 코드를 기반으로 갯수 제한 없이 자유롭게 작성해 주시되, 유익한 리뷰를 지향하도록 합니다.
73+
74+ 본인에게 할당된 리뷰 외 다른 멤버에 대한 코드 리뷰도 언제나 환영합니다.
5575
56- Pull Request 설명란에 문제를 해결하면서 어려웠던 부분이나 도움이 필요한 부분에 대해서 남겨주시면 다른 분들이 리뷰할 때 참고할 수 있어서 좋겠죠?
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def maxArea (self , height : List [int ]) -> int :
3+ left = 0
4+ right = len (height ) - 1
5+
6+ maxWater = 0
7+
8+ while left <= right :
9+ hori = right - left
10+ vert = min (height [left ], height [right ])
11+ maxWater = max (maxWater , hori * vert )
12+
13+ if height [left ] < height [right ]:
14+ left += 1
15+ else :
16+ right -= 1
17+
18+ return maxWater
19+ # TC: O(n) SC: O(1)
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def findMin (self , nums : List [int ]) -> int :
3+
4+ l = 0
5+ r = len (nums ) - 1
6+
7+ while l <= r :
8+ mid = (l + r ) // 2
9+ if nums [mid ] < nums [r ]:
10+ r = mid
11+ else :
12+ l = mid + 1
13+
14+ return nums [r ]
15+
16+ # TC: O(logn), SC: O(1)
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def characterReplacement (self , s : str , k : int ) -> int :
3+ l = 0
4+ c_frequency = {}
5+ longest_str_len = 0
6+
7+ for r in range (len (s )):
8+ if not s [r ] in c_frequency :
9+ c_frequency [s [r ]] = 0
10+ c_frequency [s [r ]] += 1
11+
12+ cells_count = r - l + 1
13+ if cells_count - max (c_frequency .values ()) <= k :
14+ longest_str_len = max (longest_str_len , cells_count )
15+
16+ else :
17+ c_frequency [s [l ]] -= 1
18+ if not c_frequency [s [l ]]:
19+ c_frequency .pop (s [l ])
20+ l += 1
21+
22+ return longest_str_len
23+
24+ ## TC: O(n), SC: O(1)
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def lengthOfLongestSubstring (self , s : str ) -> int :
3+ left = 0
4+ seen = {}
5+ res = 0
6+
7+ for right , curr in enumerate (s ):
8+ if curr in seen :
9+ left = max (left , seen [curr ] + 1 )
10+ res = max (res , right - left + 1 )
11+ seen [curr ] = right
12+
13+ return res
14+
15+ ## TC:O(n), SC:O(min(m,n)) where n is len(s) and m is size(seen)
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def search (self , nums : List [int ], target : int ) -> int :
3+ left , right = 0 , len (nums ) - 1
4+
5+ while left <= right :
6+ mid = (left + right ) // 2
7+
8+ if nums [mid ] == target :
9+ return mid
10+
11+ if nums [left ] <= nums [mid ]:
12+ if nums [left ] <= target < nums [mid ]:
13+ right = mid - 1
14+ else :
15+ left = mid + 1
16+
17+ else :
18+ if nums [mid ] < target <= nums [right ]:
19+ left = mid + 1
20+ else :
21+ right = mid - 1
22+
23+ return - 1
24+
25+ ## TC: O(n), SC: O(1)
26+
27+ # if target in nums:
28+ # return nums.index(target)
29+ # else:
30+ # return -1
31+
32+ ## TC: O(n), this may fater than bintree way if gvien nums are longer
33+ ## SC: O(n)
You can’t perform that action at this time.
0 commit comments