전체 글

Coding Test

[Python] 간단한 식 계산하기

프로그래머스 코딩 기초 트레이닝 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(binomial): a, op, b = binomial.split() if op == '+': answer = int(a)+int(b) elif op =='-': answer = int(a)-int(b) elif op == '*': answer = int(a)*int(b) return answer def solution(binomial): return eval(binomial)

Coding Test

[Python] 수식 최대화

프로그래머스 2020 카카오 인턴쉽 https://school.programmers.co.kr/learn/courses/30/lessons/67257 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr from collections import deque from itertools import permutations def solution(expression): answer = 0 ops = ['*', '+', '-'] #분리, 스택 생성 nums = [] s = 0 for idx, value in enumerate(expression): if value in..

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)

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

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]..

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에서 두 개의 점의 위치를 기록하면서 순차적으로 접근하여 문제를 해결하..

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, ..

Connieee_n
take note for -