Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 프로그래머스네트워크
- Faster R-CNN
- 프로그래머스파이썬
- Object Detection
- 코딩테스트2단계
- ECCV
- 프로그래머스게임맵최단거리
- 프로그래머스너비우선탐색
- 타겟넘버bfs
- Pytorch pruning
- Single Shot MultiBox Detector
- 프로그래머스타겟넘버
- One stage detector
- 다음큰숫자
- Pruning Tutorial
- 프로그래머스
- 커피후기
- pytorch
- Two stage Detector
- 프로그래머스타겟넘버파이썬
- SSD 리뷰
- deep learning
- Paper list
- 프로그래머스타겟넘버정답
- 코딩테스트연습
- ssd
- 코딩테스트네트워크
- 최솟값 만들기
- 프로그래머스bfs
- Code Study
Archives
- Today
- Total
soyeonland
귤고르기 본문
def solution(k, tangerine):
classify_box = {}
answer = 0
for item in tangerine:
if item in classify_box:
classify_box[item] += 1
else:
classify_box[item] = 1
classify_list = []
for category, cnt in classify_box.items():
classify_list.append([category, cnt])
classify_list = sorted(classify_list, key=lambda x:x[1], reverse=True)
sum = 0
#print('clasify_list',classify_list)
for i, (category, cnt) in enumerate(classify_list):
#print('i',i,'category', category, 'cnt',cnt , 'sum',sum)
if sum + cnt > k:
answer = i+1
break
elif sum + cnt == k:
answer = i+1
break
else:
sum += cnt
return answer
'Study > 코딩테스트 연습' 카테고리의 다른 글
프로그래머스 dfs/bfs 타겟넘버 python (0) | 2024.10.09 |
---|---|
단어변환 (0) | 2024.10.02 |
N개의 최소 공배수 (0) | 2024.07.17 |
점프와 순간이동 (0) | 2024.07.17 |
카펫 (0) | 2024.07.07 |