Skip to content
Merged
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
25 changes: 22 additions & 3 deletions CONTRIBUTING.md
Copy link
Member

Choose a reason for hiding this comment

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

๋ชจ๋“  ๋ฌธ์ œ์— ๋Œ€ํ•œ ๋‹ต์•ˆ ์ฝ”๋“œ๋ฅผ ํ•œ ๋ฒˆ์— ์˜ฌ๋ฆฌ๋ ค๊ณ  ํ•˜์ง€ ๋ง๊ณ , Draft PR์„ ํ†ตํ•ด์„œ ์กฐ๊ธˆ์”ฉ ๋‚˜๋ˆ„์–ด์„œ ์˜ฌ๋ฆฌ๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•˜๋Š” ๋‚ด์šฉ๋„ ์ถ”๊ฐ€๋˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Contributor Author

@leokim0922 leokim0922 Jun 9, 2024

Choose a reason for hiding this comment

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

@DaleSeo ์ด๋ฏธ์ง€์ถ”๊ฐ€ ๋ฐ ํ•ด๋‹น๋‚ด์šฉ, Iteration ์„ค์ •์— ๋Œ€ํ•œ ๋‚ด์šฉ๊นŒ์ง€ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆด๊ฒŒ์š”!

Copy link
Contributor Author

@leokim0922 leokim0922 Jun 9, 2024

Choose a reason for hiding this comment

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

ํ•ด๋‹น ์ด๋ฏธ์ง€ ๋ฐ ์•ž์œผ๋กœ ํ˜น์‹œ๋‚˜ ์‚ฌ์šฉ๋  ์ด๋ฏธ์ง€๋ฅผ ์œ„ํ•ด image ํด๋”๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ง€๊ธˆ PR์ƒ์—์„  ์ œ๋Œ€๋กœ ์•ˆ๋ณด์ด๋Š”๋ฐ ํฌํฌํ•œ ์ œ ๋ฅดํฌ์—์„œ๋Š” ์ •์ƒ์ ์œผ๋กœ ๋ณด์ด๋Š”๊ฑฐ ๊ฐ™์•„์š”. ํ˜น์‹œ ์ œ๊ฐ€ ๋†“์นœ๊ฒŒ ์žˆ๋‹ค๋ฉด ์ฒดํฌ ๋ถ€ํƒ๋“œ๋ฆฌ๊ณ˜์Šต๋‹ˆ๋‹ค.
Screenshot 2024-06-09 at 16 48 16

Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,27 @@ $ git push origin main

ํ™•์ธ์ด ๋˜์—ˆ์œผ๋ฉด, `Create pull request`๋ฅผ ๋ˆ„๋ฅด๊ณ , `Title`์— **๋ณธ์ธ์˜ ๋””์Šค์ฝ”๋“œ ๋‹‰๋„ค์ž„์„ ํฌํ•จ ์‹œ์ผœ์ฃผ๊ณ ** `Create pull request` ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋ฉด ๋””์Šค์ฝ”๋“œ์—๋„ ์•Œ๋ฆผ์ด ์˜ฌ๊ฒ๋‹ˆ๋‹ค.
๊ทธ๋Ÿฌ๋ฉด ๋””์Šค์ฝ”๋“œ์—๋„ ์•Œ๋ฆผ์ด ์˜ฌ๊ฒ๋‹ˆ๋‹ค. `Pull Request`๋ฅผ ์ƒ์„ฑํ•œ ๋’ค, ์šฐ์ธก `Project`ํƒญ์—์„œ `Iteration`์„ค์ •์„ ํ˜„์žฌ ์ง„ํ–‰ ์ฃผ์ฐจ์— ๋งž์ถฐ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

์ด์ œ ๋ณธ์ธ์ด ์ž‘์„ฑํ•œ ์†”๋ฃจ์…˜์„ ๋ฆฌ๋ทฐ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฆฌ๋ทฐ๊ฐ€ `approved` ๋œ๋‹ค๋ฉด ๋ฉ”์ธ ์ €์žฅ์†Œ๋ฅผ `Merge` ํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋˜ํ•œ `Draft PR` ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•ด ํ•œ ๋ฒˆ์— ๋ชจ๋“  ์†”๋ฃจ์…˜์„ ์ œ์ถœํ•˜๊ธฐ๋ณด๋‹ค ๋ณธ์ธ์˜ ์ง„ํ–‰ ์ƒํ™ฉ์„ ์ฃผ๊ธฐ์ ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

`Draft` ๋ณ€ํ™˜์€ `Pull Request` ์ƒ์„ฑ ํ›„ ์šฐ์ธก ์ƒ๋‹จ `Still in progress?` ํ•ญ๋ชฉ์„ ํ†ตํ•ด ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด์ œ ๋ณธ์ธ์ด ์ž‘์„ฑํ•œ ์†”๋ฃจ์…˜์„ ๋ฆฌ๋ทฐ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฆฌ๋ทฐ๊ฐ€ `approved` ๋œ๋‹ค๋ฉด ๋ฉ”์ธ ์ €์žฅ์†Œ์— `Merge` ํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Pull Request ์„ค๋ช…๋ž€์— ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉด์„œ ์–ด๋ ค์› ๋˜ ๋ถ€๋ถ„์ด๋‚˜ ๋„์›€์ด ํ•„์š”ํ•œ ๋ถ€๋ถ„์— ๋Œ€ํ•ด ๋‚จ๊ฒจ์ฃผ์‹œ๋ฉด ๋‹ค๋ฅธ ๋ถ„๋“ค์ด ๋ฆฌ๋ทฐํ•  ๋•Œ ์ฐธ๊ณ ํ•  ์ˆ˜ ์žˆ์–ด์„œ ์ข‹๊ฒ ์ฃ ?

Pull Request์— ๋Œ€ํ•œ ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ๋‹ค๋ฉด, ๋ณธ์ธ์˜ Pull Request๋Š” Pull Request ํ•˜๋‹จ `Merge pull request` ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ

์ง์ ‘ `Merge` ์ง„ํ–‰ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

## PR ๋‹ต์•ˆ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋ฒ•

๋ณธ์ธ์˜ Pull Request ์ž‘์„ฑ ์™„๋ฃŒ ํ›„, ๋ณธ์ธ ์งํ›„ Pull Request๋ฅผ ์ƒ์„ฑํ•œ ์Šคํ„ฐ๋””์›์˜ ์†”๋ฃจ์…˜์„ ๋ฆฌ๋ทฐํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ๋“ค์–ด,

![์˜ˆ์‹œ](images/337985716-307fdf57-90a7-4ccb-ab03-99a2d96fdc39.png)

์œ„ ํ˜•์‹์œผ๋กœ ๋ฆฌ๋ทฐ๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋ฆฌ๋ทฐ ๋‚ด์šฉ์€ ๋‹น์‹œ๊นŒ์ง€ ์ œ์ถœ ์™„๋ฃŒ๋œ ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฐฏ์ˆ˜ ์ œํ•œ ์—†์ด ์ž์œ ๋กญ๊ฒŒ ์ž‘์„ฑํ•ด ์ฃผ์‹œ๋˜, ์œ ์ตํ•œ ๋ฆฌ๋ทฐ๋ฅผ ์ง€ํ–ฅํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

๋ณธ์ธ์—๊ฒŒ ํ• ๋‹น๋œ ๋ฆฌ๋ทฐ ์™ธ ๋‹ค๋ฅธ ๋ฉค๋ฒ„์— ๋Œ€ํ•œ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋„ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.

Pull Request ์„ค๋ช…๋ž€์— ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉด์„œ ์–ด๋ ค์› ๋˜ ๋ถ€๋ถ„์ด๋‚˜ ๋„์›€์ด ํ•„์š”ํ•œ ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ ๋‚จ๊ฒจ์ฃผ์‹œ๋ฉด ๋‹ค๋ฅธ ๋ถ„๋“ค์ด ๋ฆฌ๋ทฐํ•  ๋•Œ ์ฐธ๊ณ ํ•  ์ˆ˜ ์žˆ์–ด์„œ ์ข‹๊ฒ ์ฃ ?
19 changes: 19 additions & 0 deletions container-with-most-water/Leo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution:
def maxArea(self, height: List[int]) -> int:
left = 0
right = len(height) - 1

maxWater = 0

while left <= right:
hori = right - left
vert = min(height[left], height[right])
maxWater = max(maxWater, hori * vert)

if height[left] < height[right]:
left += 1
else:
right -= 1

return maxWater
# TC: O(n) SC: O(1)
16 changes: 16 additions & 0 deletions find-minimum-in-rotated-sorted-array/Leo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution:
def findMin(self, nums: List[int]) -> int:

l = 0
r = len(nums) - 1

while l <= r:
mid = (l + r) // 2
if nums[mid] < nums[r]:
r = mid
else:
l = mid + 1

return nums[r]

# TC: O(logn), SC: O(1)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions longest-repeating-character-replacement/Leo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Solution:
def characterReplacement(self, s: str, k: int) -> int:
l = 0
c_frequency = {}
longest_str_len = 0

for r in range(len(s)):
if not s[r] in c_frequency:
c_frequency[s[r]] = 0
c_frequency[s[r]] += 1

cells_count = r - l + 1
if cells_count - max(c_frequency.values()) <= k:
longest_str_len = max(longest_str_len, cells_count)

else:
c_frequency[s[l]] -= 1
if not c_frequency[s[l]]:
c_frequency.pop(s[l])
l += 1

return longest_str_len

## TC: O(n), SC: O(1)
15 changes: 15 additions & 0 deletions longest-substring-without-repeating-characters/Leo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
left = 0
seen = {}
res = 0

for right, curr in enumerate(s):
if curr in seen:
left = max(left, seen[curr] + 1)
res = max(res, right - left + 1)
seen[curr] = right

return res

## TC:O(n), SC:O(min(m,n)) where n is len(s) and m is size(seen)
Copy link
Contributor

Choose a reason for hiding this comment

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

๊ณต๊ฐ„ ๋ณต์žก๋„๋ฅผ O(n) ์œผ๋กœ ์ •๋ฆฌํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์€๋ฐ
ํŠน๋ณ„ํžˆ m (size(seen)) ์ด๋ผ๋Š” ๊ฒƒ์„ ์ถ”๊ฐ€๋กœ ๊ณ ๋ คํ•˜์‹  ์ด์œ ๊ฐ€ ์žˆ์œผ์‹ค๊นŒ์š”?

Copy link
Contributor Author

@leokim0922 leokim0922 Jun 8, 2024

Choose a reason for hiding this comment

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

์ €๋„ ์ฒ˜์Œ์— ํ’€๋• O(n)์ด๋ผ ์ƒ๊ฐํ–ˆ๋Š”๋ฐ์š”, ์ด๋ฒˆ์— ํ’€๋ฉด์„œ ์ƒ๊ฐํ•ด๋ณด๋‹ˆ๊นŒ ์˜ˆ๋ฅผ๋“ค์–ด ์•ŒํŒŒ๋ฒณ์ด๋ผ๊ณ  ๊ฐ€์ •ํ–ˆ์„ ๋•Œ s์˜ ๊ธธ์ด๋Š” ์ด๋ก ์ ์œผ๋กœ 10000๊ฐœ๋„ ๋„ฃ์„ ์ˆ˜ ์žˆ๊ฒ ์ง€๋งŒ, seen์— ๋“ค์–ด๊ฐ€๋Š”๊ฑด ๊ฒฐ๊ตญ ์•ŒํŒŒ๋ฒณ ์ตœ๋Œ€๊ฐฏ์ˆ˜๋ฅผ ๋„˜์–ด์„ค ์ˆ˜ ์—†๊ณ , ๋ฐ˜๋Œ€๋กœ s๊ฐ€ 26์ž๋ณด๋‹ค ์งง๋‹ค๋ฉด ๊ทธ ๊ธธ์ด๋งŒํผ๋งŒ ๊ณ ๋ คํ•˜๋ฉด ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์–ด์š”. ๊ทธ๋ž˜์„œ ๋‘ ๊ฒฝ์šฐ ์ค‘ min๊ฐ’์„ ๊ฐ€์ ธ๊ฐ€๋Š”๊ฒŒ ์ข€๋” ๋””ํ…Œ์ผํ•œ ๋ถ„์„์ด ์•„๋‹๊นŒ ์ƒ๊ฐํ•ด๋ดค์Šต๋‹ˆ๋‹ค ๐Ÿ˜„

Copy link
Contributor

Choose a reason for hiding this comment

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

์‹œ๊ฐ„ ๋ณต์žก๋„ ๊ณ„์‚ฐํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋น… ์˜ค ํ‘œ๊ธฐ๋ฒ•์—์„œ๋Š”
๊ณ„์ˆ˜์™€ ๋‚ฎ์€ ์ฐจ์ˆ˜์˜ ํ•ญ์„ ์ œ์™ธ์‹œํ‚ค๊ธฐ ๋•Œ๋ฌธ์— ์•ŒํŒŒ๋ฒณ ์ตœ๋Œ€ ๊ฐฏ์ˆ˜ (26) ๋Š” ๋ฌด์‹œํ•ด๋„ ๋˜์ง€ ์•Š์„๊นŒ ์ƒ๊ฐ์ด ๋“ค๊ธด ํ•˜๋„ค์š”

33 changes: 33 additions & 0 deletions search-in-rotated-sorted-array/Leo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class Solution:
def search(self, nums: List[int], target: int) -> int:
left, right = 0, len(nums) - 1

while left <= right:
mid = (left + right) // 2

if nums[mid] == target:
return mid

if nums[left] <= nums[mid]:
if nums[left] <= target < nums[mid]:
right = mid - 1
else:
left = mid + 1

else:
if nums[mid] < target <= nums[right]:
left = mid + 1
else:
right = mid - 1

return -1

## TC: O(n), SC: O(1)

# if target in nums:
# return nums.index(target)
# else:
# return -1

## TC: O(n), this may fater than bintree way if gvien nums are longer
## SC: O(n)