๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ 479

โฌ› [Programmers] [Python] [2018 KAKAO BLIND RECRUITMENT] [Level2] [3์ฐจ] ์••์ถ•

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/17684/solution_groups?language=python3 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 2๋‹จ๊ณ„ - ์••์ถ• def solution(msg): answer = [] d = {chr(65+i) : i+1 for i in range(26)} w, c = 0, 0 while True: c += 1 if c == len(msg): answer.append(d[msg[w:c]]) break if msg[w:c+1..

[Github] ๋ธ”๋กœ๊ทธ ์ตœ์‹ ๊ธ€ Github README์— ์˜ฌ๋ฆฌ๊ธฐ

Github์— README ๋ธ”๋กœ๊ทธ ์ตœ์‹ ๊ธ€ ์ž๋™ํ™”ํ•˜๊ธฐ Github์˜ README์— ๋ธ”๋กœ๊ทธ ์ตœ์‹ ๊ธ€์„ ์ž๋™์œผ๋กœ ์˜ฌ๋ ค์ฃผ๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•  ๊ฒƒ์ด๋‹ค. ๊ณผ์ •์ด ๋งค์šฐ ๊ฐ„๋‹จํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋น ๋ฅด๊ฒŒ README๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ๋‹ค. 1. RSS ํ”ผ๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” Python ์ฝ”๋“œ ์ž‘์„ฑ pip install feedparser ๋จผ์ € feedparser ๋ชจ๋“ˆ์ด ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์šด๋ฐ›์•„์ค€๋‹ค. ๋‚ด RSS ํ”ผ๋“œ URL ํ™•์ธ https://dev-wnstjd.tistory.com/rss ์ž์‹ ์˜ ๋ธ”๋กœ๊ทธ URL / rss ๋ฅผ ๋ถ™์—ฌ์ฃผ๋ฉด ๋œ๋‹ค. ํ‹ฐ์Šคํ† ๋ฆฌ ๋ธ”๋กœ๊ทธ๋Š” ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋˜๊ณ  ๊นƒํ—ˆ๋ธŒ ๋ธ”๋กœ๊ทธ๋‚˜ ๋ฒจ๋กœ๊ทธ ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ๋‹ค๋ฅผ ์ˆ˜ ์žˆ๋‹ค. 2. Python ์ฝ”๋“œ ์ž‘์„ฑ ๋จผ์ € ์ž์‹ ์˜ README ์ €์žฅ์†Œ์— main.py ํŒŒ์ผ์„ ํ•˜๋‚˜ ๋งŒ๋“ ๋‹ค. import feedpa..

โฌ› [Programmers] [Python] [Level1] ์ถ”์–ต ์ ์ˆ˜

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/176963 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 1๋‹จ๊ณ„ - ์ถ”์–ต ์ ์ˆ˜ def solution(name, yearning, photo): answer = [] d = {} for i in range(len(name)): d[name[i]] = yearning[i] for i in range(len(photo)): res =0 for j in range(len(photo[i])): if photo[i][j] in d: ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver4] 1302๋ฒˆ_๋ฒ ์ŠคํŠธ์…€๋Ÿฌ

๋ฌธ์ œ https://www.acmicpc.net/problem/1302 1302๋ฒˆ: ๋ฒ ์ŠคํŠธ์…€๋Ÿฌ ์ฒซ์งธ ์ค„์— ์˜ค๋Š˜ ํ•˜๋ฃจ ๋™์•ˆ ํŒ”๋ฆฐ ์ฑ…์˜ ๊ฐœ์ˆ˜ N์ด ์ฃผ์–ด์ง„๋‹ค. ์ด ๊ฐ’์€ 1,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ž์—ฐ์ˆ˜์ด๋‹ค. ๋‘˜์งธ๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์— ์ฑ…์˜ ์ œ๋ชฉ์ด ์ž…๋ ฅ์œผ๋กœ ๋“ค์–ด์˜จ๋‹ค. ์ฑ…์˜ ์ œ๋ชฉ์˜ ๊ธธ์ด๋Š” 50๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๊ณ  www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 1302๋ฒˆ ๋ฌธ์ œ - ๋ฒ ์ŠคํŠธ์…€๋Ÿฌ n = int(input()) book = {} for _ in range(n): name = input() if name not in book: book[name] = 0 book[name] += 1 print(sorted(list(book.items()), key=lambda x : (-x[1],x[0]))[0][0]) sort๋ฅผ ์ด์šฉํ•ด..

โฌ› [Programmers] [Python] [Level3] ์•ผ๊ทผ ์ง€์ˆ˜

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/12927 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 2๋‹จ๊ณ„ - ์•ผ๊ทผ ์ง€์ˆ˜ import heapq def solution(n, works): answer = 0 heap = [] # ์‹œ๊ฐ„์•ˆ์— ์ž‘์—…์„ ๋๋‚ผ ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ if sum(works) 0: work = heapq.heappop(heap)[1] - 1 heapq.heappush(heap, (-work, work)) n -= 1 for h in heap: if h[1]..

โฌ› [Programmers] [Python] [2022 KAKAO BLIND RECRUITMENT] [Level2] K์ง„์ˆ˜์—์„œ ์†Œ์ˆ˜ ๊ฐœ์ˆ˜ ๊ตฌํ•˜๊ธฐ

๋ฌธ์ œ https://school.programmers.co.kr/learn/challenges?order=acceptance_desc&statuses=unsolved&levels=2%2C3%2C1&languages=python3 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต | ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์Šค์ฟจ ๊ฐœ๋ฐœ์ž ์ทจ์—…์˜ ํ•„์ˆ˜ ๊ด€๋ฌธ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋ฅผ ์ฒ ์ €ํ•˜๊ฒŒ ์—ฐ์Šตํ•˜๊ณ  ๋Œ€๋น„ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ๋ฅผ ์ด๋ง๋ผ! ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์—์„œ ์„ ๋ฐœํ•œ ๋ฌธ์ œ๋กœ ์œ ํ˜•์„ ํŒŒ์•…ํ•˜๊ณ  ์‹ค๋ ฅ์„ ์—…๊ทธ๋ ˆ์ด๋“œํ•ด ๋ณด์„ธ์š”! school.programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 2๋‹จ๊ณ„ - k์ง„์ˆ˜์—์„œ ์†Œ์ˆ˜ ๊ฐœ์ˆ˜ ๊ตฌํ•˜๊ธฐ import math def isPrime(n): if n == 1: return False for i in range(2, int(math.sqrt(n)) + 1): if n ..

โฌ› [Programmers] [Python] [Level2] ์ „ํ™”๋ฒˆํ˜ธ ๋ชฉ๋ก

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/42577 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 2๋‹จ๊ณ„ - ์ „ํ™”๋ฒˆํ˜ธ ๋ชฉ๋ก def solution(phone_book): hash_map = {} for phone_number in phone_book: hash_map[phone_number] = 1 for phone_number in phone_book: s = "" for number in phone_number: s += number if s in hash_map..

โฌ› [Programmers] [Python] [Level3] ์ด์ค‘ ์šฐ์„ ์ˆœ์œ„ ํ

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/42628 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 3๋‹จ๊ณ„ - ์ด์ค‘ ์šฐ์„ ์ˆœ์œ„ ํ import heapq def solution(operations): heap = [] max_heap = [] for o in operations: current = o.split() if current[0] == 'I': num = int(current[1]) heapq.heappush(heap, num) # ์ตœ์†Œ ํž™ heapq.heapp..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 4179๋ฒˆ_๋ถˆ!

๋ฌธ์ œ https://www.acmicpc.net/problem/4179 4179๋ฒˆ: ๋ถˆ! ์ž…๋ ฅ์˜ ์ฒซ์งธ ์ค„์—๋Š” ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ๋‘ ์ •์ˆ˜ R๊ณผ C๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ, 1 ≤ R, C ≤ 1000 ์ด๋‹ค. R์€ ๋ฏธ๋กœ ํ–‰์˜ ๊ฐœ์ˆ˜, C๋Š” ์—ด์˜ ๊ฐœ์ˆ˜์ด๋‹ค. ๋‹ค์Œ ์ž…๋ ฅ์œผ๋กœ R์ค„๋™์•ˆ ๊ฐ๊ฐ์˜ ๋ฏธ๋กœ ํ–‰์ด ์ฃผ์–ด์ง„๋‹ค. ๊ฐ๊ฐ์˜ ๋ฌธ์ž www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 4179๋ฒˆ ๋ฌธ์ œ - ๋ถˆ! import sys from collections import deque input = sys.stdin.readline n, m = map(int, input().split()) graph = [] for i in range(n): graph.append(list(input().rstrip())) if 'J' in graph[i]: q..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver5] 7785๋ฒˆ_ํšŒ์‚ฌ์— ์žˆ๋Š” ์‚ฌ๋žŒ

๋ฌธ์ œ https://www.acmicpc.net/problem/7785 7785๋ฒˆ: ํšŒ์‚ฌ์— ์žˆ๋Š” ์‚ฌ๋žŒ ์ฒซ์งธ ์ค„์— ๋กœ๊ทธ์— ๊ธฐ๋ก๋œ ์ถœ์ž… ๊ธฐ๋ก์˜ ์ˆ˜ n์ด ์ฃผ์–ด์ง„๋‹ค. (2 ≤ n ≤ 106) ๋‹ค์Œ n๊ฐœ์˜ ์ค„์—๋Š” ์ถœ์ž… ๊ธฐ๋ก์ด ์ˆœ์„œ๋Œ€๋กœ ์ฃผ์–ด์ง€๋ฉฐ, ๊ฐ ์‚ฌ๋žŒ์˜ ์ด๋ฆ„์ด ์ฃผ์–ด์ง€๊ณ  "enter"๋‚˜ "leave"๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. "enter"์ธ ๊ฒฝ์šฐ๋Š” www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 7785๋ฒˆ ๋ฌธ์ œ - ํšŒ์‚ฌ์— ์žˆ๋Š” ์‚ฌ๋žŒ n = int(input()) d = dict() for _ in range(n): name, status = map(str, input().split()) if status == 'enter': d[name] = status else: d[name] = 'leave' people = [] for ke..