파이썬

H-Indexhttps://school.programmers.co.kr/learn/courses/30/lessons/42747 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제코드citations 리스트를 내림차순으로 정렬루프를 돌면서 현재 인용횟수(i)가 현재의 h_index보다 크거나 같으면 h_index 값을 +1def solution(citations): citations.sort(reverse=True) h_index = 0 for i in citations: if i > h_index: h_inde..
n^2 배열 자르기https://school.programmers.co.kr/learn/courses/30/lessons/87390 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제 입출력 예 설명입출력 예 #1 입출력 예 #2코드시간 초과def solution(n, left, right): answer = [] for i in range(n): for j in range(n): if i >= j: answer.append(i+1) else: ..
할인 행사https://school.programmers.co.kr/learn/courses/30/lessons/131127 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제 코드딕셔너리를 활용한 풀이할인하는 제품들도 딕셔너리로 만들고 일치하면 answer += 1from collections import Counterdef solution(want, number, discount): answer = 0 dic = dict(zip(want, number)) for i in range(len(discount)-9): sales =..
괄호 회전하기https://school.programmers.co.kr/learn/courses/30/lessons/76502 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제코드stack, pop을 활용하기 위한 list로 변형두 개의 for문을 활용def solution(s): answer = 0 s = list(s) for _ in range(len(s)): lst = [] for i in range(len(s)): if len(lst) > 0: if lst[-1]..
연속 부분 수열의 합의 개수https://school.programmers.co.kr/learn/courses/30/lessons/131701 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제코드시간 초과def solution(elements): answer = [] new_elements = elements * 2 for i in range(len(elements)): for j in range(len(elements)): sum_result = sum(new_elements[j:j+i+1]) ..
potato_pizza
'파이썬' 태그의 글 목록 (8 Page)