๋ฐ์ํ
Notice
Recent Posts
Recent Comments
Link
| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ๋ฐฑ์ค
- kakao
- ํ๋ก๊ทธ๋๋จธ์ค
- BFS
- ๊ทธ๋ํ
- sort
- ์นด์นด์ค
- SWEA
- ์ฝ๋ฉํ ์คํธ
- SSAFY
- ์ผ์ฑ
- ์๋ฃ๊ตฌ์กฐ
- DP
- ์คํ
- ์์ ํ์
- ์ฝํ
- ํ์ด์ฌ
- ์ธํผ
- boj
- Backjoon
- ํํ
- DFS
- Blind
- SW์ญ๋ํ ์คํธ
- ์๊ณ ๋ฆฌ์ฆ
- algorithm
- ๋ค์ด๋๋ฏนํ๋ก๊ทธ๋๋ฐ
- Python
- javascript
- ์๋ฐ์คํฌ๋ฆฝํธ
Archives
- Today
- Total
๋ง์ํ
[python] ํ๋ก๊ทธ๋๋จธ์ค - ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ(2022 KAKAO BLIND RECRUITMENT) ๋ณธ๋ฌธ
Algorithm Problem/Python
[python] ํ๋ก๊ทธ๋๋จธ์ค - ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ(2022 KAKAO BLIND RECRUITMENT)
deo2kim 2022. 2. 3. 20:19๋ฐ์ํ

๐ค๋ฌธ์ ํด๊ฒฐ


๐จ ๋ค๋ฅธ ํ์ด์ ๊ฒฝ์ฐ ๋์ ๋๋ฆฌ๋ฅผ ๋ฐ๋ก ๋ง๋ค์ง ์๊ณ ํ์ด์ ๋ฉ๋ชจ๋ฆฌ์์๋ ์ด์ ์ด ์๊ณ ์๋๊ฐ ๋๋ฆฐ ๋จ์ ์ด ์์ง๋ง, ๋์ ๊ฒฝ์ฐ์ ๋์ ๋๋ฆฌ ์ฐ๋ ๊ฒ์ ์ข์ํ์ฌ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ ์ฌ์ฉํ์ง๋ง ์๋๋ 10๋ฐฐ ๋นจ๋๋ค(ex. 3๋ฒ๋ฌธ์ 1000ms vs 100ms)
๐ป์์ค ์ฝ๋
def solution(id_list, report, k):
answer = []
reported_dict = {id: {'reporter': set(), 'mail_cnt': 0} for id in id_list}
for r in report:
reporter, reported_person = r.split(' ')
reported_dict[reported_person]['reporter'].add(reporter)
for key, val in reported_dict.items():
if len(val['reporter']) >= k:
for reporter in reported_dict[key]['reporter']:
reported_dict[reporter]['mail_cnt'] += 1
for val in reported_dict.values():
answer.append(val['mail_cnt'])
return answer
๐๋ฌธ์ ํ์ธ
์ถ์ฒ: ํ๋ก๊ทธ๋๋จธ์ค
๋งํฌ: ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ
๋ฐ์ํ
'Algorithm Problem > Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [python] ํ๋ก๊ทธ๋๋จธ์ค - n^2 ๋ฐฐ์ด ์๋ฅด๊ธฐ(์๊ฐ ์ฝ๋ ์ฑ๋ฆฐ์ง ์์ฆ3) (0) | 2022.02.05 |
|---|---|
| [python] ํ๋ก๊ทธ๋๋จธ์ค - ํผ๋ก๋(์ํด๋ฆฌ์ฑ๋ฆฐ์ง) (0) | 2022.02.04 |
| [python] ๋ฐฑ์ค - 20055. ์ปจ๋ฒ ์ด์ด ๋ฒจํธ ์์ ๋ก๋ด (0) | 2021.10.04 |
| [python] ํ๋ก๊ทธ๋๋จธ์ค - ์ํด๋ฆฌ์ฑ๋ฆฐ์ง 7์ฃผ์ฐจ (0) | 2021.10.02 |
| [python] ๋ฐฑ์ค - 1018. ์ฒด์คํ ๋ค์ ์น ํ๊ธฐ (0) | 2021.09.22 |