[프로그래머스] / [Level 2] / [Python] 마법의 엘레베이터
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/148653 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(storey): answer = 0 while storey: mod = storey % 10 if mod > 5: _add = 10 - mod storey += _add answer += _add elif mod 50: stor..
[Python] pafy로 Youtube 영상 처리
·
Develop/Python
pafyhttps://github.com/mps-youtube/pafy GitHub - mps-youtube/pafy: Python library to download YouTube content and retrieve metadataPython library to download YouTube content and retrieve metadata - GitHub - mps-youtube/pafy: Python library to download YouTube content and retrieve metadatagithub.com How to use ?다음과 같이 instance를 선언한 뒤 필요한 정보를 얻을 수 있다.import pafyurl = "https://www.youtube.com/watch..
[Python] Poetry 설치 & 간단한 실습 (FastAPI)
·
Develop/Python
PoetryPython Dependecy Manager로 Python 프로젝트에 대한 모든 dependency를 선언, 관리, 설치하여 어디서나 프로젝트가 작동하도록 도와주는 툴입니다. Poetry는 .toml 파일과 .lock 파일을 생성해 dependency를 관리합니다..toml 파일에는 프로젝트 dependency의 Metadata가,.lock 파일에는 설치된 패키지들의 version, hash가 저장되어 있습니다.Installhttps://python-poetry.org/docs/#installing-with-the-official-installer Introduction | Documentation | Poetry - Python dependency management and packaging..
[프로그래머스] / [Level 2] / [Python] 호텔 대실
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 주의할 점으로 한 번 사용한 객실은 퇴실 시간을 기준으로 10분간 청소를 하고 다음 손님들이 사용할 수 있습니다. 조건을 확인해야 한다. from collections import deque def solution(book_time): room = [] book_time = [[int(b[0][:2])*60+int(b[0][-2:]), int(b[1][:2])*60+int(b[1][-2:])] ..
[프로그래머스] / [Level 2] / [Python] 무인도 여행
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/154540 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 전형적인 DFS/BFS 문제이다. 주의할 점으로 Python에서 기본적으로 재귀 함수의 깊이가 제한(RecursionError)이 되어 있어 이를 해제해야 한다. import sys sys.setrecursionlimit(10**5) def solution(maps): answer = [] row, col = len(maps), len(maps[0]) maps = [list(map) for ma..
[프로그래머스] / [Level 2] / [Python] 연속된 부분 수열의 합
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/178870 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(sequence, k): answer = [] s = 0 e = 0 l = len(sequence) sum_ = 0 while True: if sum_ = l: break sum_ += sequence[e] e += 1 else: sum_ -= sequence[s] if s >= l: break s += 1 answer = sorted(answer, key=lambda x..
[프로그래머스] / [Level 1] / [Python] 가장 가까운 같은 글자
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/142086 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr from collections import defaultdict def solution(s): answer = [] d = defaultdict(lambda: -1) for idx, s_ in enumerate(s): if d[s_] == -1: answer.append(-1) d[s_] = idx else: answer.append(idx-d[s_]) d[s_] = idx return answer
[프로그래머스] / [Level 1] / [Python] 푸드 파이트 대회
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/134240?language=python3 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(food): answer = [] for idx, num in enumerate(food): if idx == 0: continue for _ in range(num//2): answer.append(str(idx)) answer.append(str(0)) return ''.join(answer) + ''.join(answer[-2::-1])..
욱근욱
'분류 전체보기' 카테고리의 글 목록 (25 Page)