일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 백준 #백준알고리즘 #알고리즘 #코딩테스트 #코딩테스트준비 #코테준비 #백준2110 #python #문제풀이
- 백준 #백준2217 #백준로프 #python
- 프로그래머스 #c++ #코딩테스트
- 백준 #이거다시풀기
- 카카오 코테
- 동
- 카카오 #프로그래머스 #python #코딩테스트 #오픈채팅방
- 프로그래머스 #sql #mysql #코딩테스트
- 프로그래머스 #NULL 처리하기
- 그리디알고리즘 #그리디 #백준 #우선순위큐 #최소힙 #최대힙 #알고리즘 #코딩테스트 #python
- 프로그래머스 #python #2021카카오 #카카오코테 #카카오인턴쉽
- 프로그래머스 #네트워크 #c++ #코딩테스트 #코테 #코테준비 #dfs
- 프로그래머스 #python #코딩테스트 #코테공부 #알고리즘 #dict
- Today
- Total
목록알고리즘 문제 풀이/프로그래머스 (83)
say repository
https://programmers.co.kr/learn/courses/30/lessons/42889 코딩테스트 연습 - 실패율 실패율 슈퍼 게임 개발자 오렐리는 큰 고민에 빠졌다. 그녀가 만든 프랜즈 오천성이 대성공을 거뒀지만, 요즘 신규 사용자의 수가 급감한 것이다. 원인은 신규 사용자와 기존 사용자 사이에 스 programmers.co.kr def solution(N, stages): answer = {} cntplayer = len(stages) # 각 스테이지별 실패율 딕셔너리에 저장 for i in range(1,N+1): if cntplayer != 0: answer[i] = stages.count(i) /cntplayer # 실패율 cntplayer -= stages.count(i) els..
https://programmers.co.kr/learn/courses/30/lessons/42746# 출처 : 프로그래머스 코딩테스트 연습 - 가장 큰 수 0 또는 양의 정수가 주어졌을 때, 정수를 이어 붙여 만들 수 있는 가장 큰 수를 알아내 주세요. 예를 들어, 주어진 정수가 [6, 10, 2]라면 [6102, 6210, 1062, 1026, 2610, 2106]를 만들 수 있고, 이중 가장 큰 programmers.co.kr def solution(numbers): numbers = list(map(str,numbers)) # string 리스트로 변경 numbers.sort(key = lambda x:x*3,reverse = True) # print(numbers) return str(int('..
https://programmers.co.kr/learn/courses/30/lessons/42579 출처 : 프로그래머스 코딩테스트 연습 - 베스트앨범 스트리밍 사이트에서 장르 별로 가장 많이 재생된 노래를 두 개씩 모아 베스트 앨범을 출시하려 합니다. 노래는 고유 번호로 구분하며, 노래를 수록하는 기준은 다음과 같습니다. 속한 노래가 programmers.co.kr def solution(genres, plays): answer = [] arr = sorted([[genres[i], plays[i], i] for i in range(len(genres))],key = lambda x:(x[0],-x[1], x[2])) # 재생횟수 total_play = {} for i in arr: if i[0] n..
https://programmers.co.kr/learn/courses/30/lessons/42578 출처 : 프로그래머스 코딩테스트 연습 - 위장 programmers.co.kr def solution(clothes): answer = 1 clothes_hash = {} for c_name, c_type in clothes: if c_type not in clothes_hash: # 처음 해쉬에 넣는 옷 종류면 clothes_hash[c_type] = 2 # 안 입는 경우 까지 더해서 2 else: clothes_hash[c_type] += 1 for c in clothes_hash.values(): answer *= c return answer-1 풀이 해시와 경우의 수로 풀이했다. 해시에 넣을 때,..
출처 : 프로그래머스 https://programmers.co.kr/learn/courses/30/lessons/42577 코딩테스트 연습 - 전화번호 목록 전화번호부에 적힌 전화번호 중, 한 번호가 다른 번호의 접두어인 경우가 있는지 확인하려 합니다. 전화번호가 다음과 같을 경우, 구조대 전화번호는 영석이의 전화번호의 접두사입니다. 구조 programmers.co.kr def solution(phone_book): answer = True # 전화번호부 해시 생성 hashmap = {} for phone_num in phone_book: hashmap[phone_num] = 1 # 접두사 찾기 for phone_num in phone_book: tmp = '' for num in phone_num: t..
https://programmers.co.kr/learn/courses/30/lessons/42576 코딩테스트 연습 - 완주하지 못한 선수 수많은 마라톤 선수들이 마라톤에 참여하였습니다. 단 한 명의 선수를 제외하고는 모든 선수가 마라톤을 완주하였습니다. 마라톤에 참여한 선수들의 이름이 담긴 배열 participant와 완주한 선수 programmers.co.kr 출처 : 프로그래머스 def solution(participant, completion): # 정렬 participant.sort() completion.sort() for i,j in zip(participant, completion): if i!=j: return i return participant[-1]
https://programmers.co.kr/learn/courses/30/lessons/64061 코딩테스트 연습 - 크레인 인형뽑기 게임 [[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]] [1,5,3,5,1,2,1,4] 4 programmers.co.kr 출처 : 프로그래머스 def solution(board, moves): answer = 0 basket = [] # 바구니 스택 for move in moves: for i in board: if i[move-1] != 0: # 인형이 있다면 basket.append(i[move - 1]) # 바구니에 넣는다. i[move - 1] = 0 # 인형 빼고 빈칸으로 만들어준다. # print..