Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- cos pro
- Algorithm
- 동적계획법과최단거리역추적
- 백준
- android
- django
- DFS와BFS
- 코딩테스트
- Flutter
- cos pro 1급
- DFS
- 동적계획법
- cos
- DART
- 알고리즘
- issue
- Python
- codingtest
- 코드품앗이
- 파이썬
- 코테
- 안드로이드
- C++
- AndroidStudio
- 개발
- docker
- 안드로이드스튜디오
- BAEKJOON
- vuejs
- 분할정복
Archives
- Today
- Total
목록cos pro 1급 큰수와 작은수의 차이 python (1)
Development Artist

문제 유형 코딩 난이도 normal Note 1. combination(조합) 으로 해결. 2. for문을 돌면서 min과 max를 구해서 빼고 결과를 answer에 업데이트. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean import itertools def solution(arr, K): answer = 10001 list_a = list(itertools.combinations(arr, K)) for nums in list_a: list_nums = list(set(nums)) max_n, min_n = max(list_nums), min(list_nums) rtn = max_n - min_n if rtn < answer: answ..
Algorithm/COS
2022. 2. 28. 17:45