Skip to content
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

6-kjs254 #22

Merged
merged 2 commits into from
Mar 5, 2024
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
16 changes: 16 additions & 0 deletions kjs254/DFS/๋ชจ์Œ์‚ฌ์ „.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def dfs(my_word):
global dic
vowel = ['A','E','I','O','U']

if len(my_word)<=5:
dic.append(my_word)

for v in vowel:
dfs(my_word + v)

def solution(word):
global dic
dic = []
dfs('')
answer = dic.index(word)
return answer
9 changes: 5 additions & 4 deletions kjs254/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
|:----:|:---------:|:----:|:-----:|:----:|
| 1์ฐจ์‹œ | 2024.02.12 | ์Šคํƒ | [๊ธฐ๋Šฅ๊ฐœ๋ฐœ](https://school.programmers.co.kr/learn/courses/30/lessons/42586) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/2) |
| 2์ฐจ์‹œ | 2024.02.15 | ํ | [ํ”„๋กœ์„ธ์Šค](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/6) |
| 3์ฐจ์‹œ | 2024.02.15 | ํž™ | [์•ผ๊ทผ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
| 4์ฐจ์‹œ | 2024.02.15 | ํž™ | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/14) |
| 5์ฐจ์‹œ | 2024.02.15 | ํž™ | [๋ชจ์Œ์‚ฌ์ „](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) |
---
| 3์ฐจ์‹œ | 2024.02.18 | ํž™ | [์•ผ๊ทผ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
| 4์ฐจ์‹œ | 2024.02.21 | ํ | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/14) |
| 5์ฐจ์‹œ | 2024.02.24 | DFS | [๋ชจ์Œ์‚ฌ์ „](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) |
| 6์ฐจ์‹œ | 2024.02.27 | ์Šคํƒ | [๊ด„ํ˜ธ ํšŒ์ „ํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/76502) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/22) |
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def func(bracket):
stk = []
for b in bracket:
if b in ["[","{","("]:
stk.append(b)
elif b in ["]","}",")"]:
if not stk:
return False
if stk[-1]=="[" and b=="]":
stk.pop()
elif stk[-1]=="{" and b=="}":
stk.pop()
elif stk[-1]=="(" and b==")":
stk.pop()
else:
return False
Comment on lines +6 to +16
Copy link
Collaborator

Choose a reason for hiding this comment

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

์ด๋ถ€๋ถ„์€ ๊ด„ํ˜ธ๊ฐ€ ์ง์ด ์ง€์–ด์ง€๋Š” ๊ณผ์ •์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ถ€๋ถ„์ด๋ผ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฑด ๋‹ค ๋˜‘๊ฐ™๋„ค์š”.
์ €๋Š” ๊ฐœ์ธ์ ์œผ๋กœ๋Š” ์ด๋Ÿฐ ๊ณผ์ •์ด ๋‚˜์˜ค๋ฉด ํ•œ๊บผ๋ฒˆ์— ๋ฌถ์–ด์„œ ์ฒ˜๋ฆฌํ•˜๋Š” ํŽธ์ž…๋‹ˆ๋‹ค.
๋‹ค๋งŒ ์ด๋Ÿฐ ๋ฐฉ์‹๋„ ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์ ธ์„œ ์ฝ๊ธฐ ํŽธํ•˜๋„ค์š”.

Copy link
Member Author

Choose a reason for hiding this comment

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

์ด๋ถ€๋ถ„์€ ๊ด„ํ˜ธ๊ฐ€ ์ง์ด ์ง€์–ด์ง€๋Š” ๊ณผ์ •์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ถ€๋ถ„์ด๋ผ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฑด ๋‹ค ๋˜‘๊ฐ™๋„ค์š”. ์ €๋Š” ๊ฐœ์ธ์ ์œผ๋กœ๋Š” ์ด๋Ÿฐ ๊ณผ์ •์ด ๋‚˜์˜ค๋ฉด ํ•œ๊บผ๋ฒˆ์— ๋ฌถ์–ด์„œ ์ฒ˜๋ฆฌํ•˜๋Š” ํŽธ์ž…๋‹ˆ๋‹ค. ๋‹ค๋งŒ ์ด๋Ÿฐ ๋ฐฉ์‹๋„ ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์ ธ์„œ ์ฝ๊ธฐ ํŽธํ•˜๋„ค์š”.

์ €๋„ ๋ฌถ์–ด์„œ ํ•œ๋ฒˆ์— ์ฒ˜๋ฆฌํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„ํ• ์ง€ ๊ฐ์ด ์ž˜ ์•ˆ์žกํ˜€์„œ ๊ทธ๋ƒฅ ์ผ์ผ์ด ์ ์—ˆ์Šต๋‹ˆ๋‹ค...

๋‚˜์ค‘์— ์•Œ์•„๋ณด๋‹ˆ ๋”•์…”๋„ˆ๋ฆฌ๋กœ ๋ฌถ์–ด์„œ ์ง์„ ์ง€์œผ๋ฉด ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„๋˜๋”๋ผ๊ตฌ์š”

return not stk

def solution(s):
answer = 0
l = len(s)
for i in range(l):
x = s[i:]+s[:i]
if func(x):
answer +=1

return answer
16 changes: 16 additions & 0 deletions kjs254/ํ/๊ตฌ๋ช…๋ณดํŠธ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from collections import deque

def solution(people, limit):
answer = 0
people = deque(sorted(people))

while len(people)>1:
if people[0]+people[-1]<=limit:
people.pop()
people.popleft()
answer+=1
else:
people.pop()
answer+=1

return answer+1 if people else answer