Python

Python/Coding Test

[Python][정렬] H-Index

프로그래머스 정렬 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(citations): citations.sort(reverse = True) for idx, value in enumerate(citations): if idx >= value: return idx return len(citations)

Python/Coding Test

[Python] 5명씩

기초 트레이닝 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(names): return [names[i] for i in range(0,len(names),5)] def solution(names): answer= [] for i in range(0, len(names), 5): a = names[i] answer.append(a) return answer

Python/Coding Test

[Python][DFS] 여행경로

프로그래머스 여행경로 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr candidates = [] def visit(start, graph, visited, cnt, route): global candidates if cnt == len(graph): candidates.append(route.split(" ")) else: for i in range(len(graph)): if visited[i] == 0 and graph[i][0] == start: go = [] for j in range(len(visited)): go.append(visited[j]..

Python/Coding Test

[Python][Two Pointers] 두 큐 합 같게 만들기

프로그래머스 2022 KAKAO TECH INTERNSHIP 두 큐 합 같게 만들기 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Two Pointers Algorithm: a search algorithm used to solve problems involving collections such as arrays and lists by comparing elements pointed by two pointers and updating them accordingly. list와 array에서 두 개의 점의 위치를 기록하면서 순차적으로 접근하여 문제를 해결하..

Python/Coding Test

[Python] 로또의 최고 순위와 최저 순위

프로그래머스 2021 Dev-Matching: 웹 백엔드 개발자 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답코드 def solution(lottos, win_nums): rank=[6,6,5,4,3,2,1] cnt_0 = lottos.count(0) ans = 0 for x in win_nums: if x in lottos: ans += 1 return rank[cnt_0 + ans],rank[ans] 정답은 출력되지만 런타임 에러로 문제해결 실패한 코드 from collections import Counter rank = {1: 6, 2: 5, ..

log:->
'Python' 카테고리의 글 목록 (4 Page)