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

문제 유형 한줄 수정 난이도 normal Note 1. 연속된 3자리수 체크 하는 알고리즘. 연속된 x, y, z 문자 or 숫자가 있다면 y-x, z-y의 차이가 같아야 한다. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 9번 def solution(password): length = len(password) for i in range(length - 2): first_check = ord(password[i + 1]) - ord(password[i]) second_check = ord(password[i + 2]) - ord(password[i + 1]) if first_check == second_check and (fi..

문제 유형 한줄 수정 난이도 easy Note 1. 배열 양끝에서 하나씩 번갈아가면서 원소 선택하는 알고리즘. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 8번 def solution(arr): left, right = 0, len(arr) - 1 idx = 0 answer = [0 for _ in range(len(arr))] while left

문제 유형 빈칸 난이도 normal Note 1. Greedy 알고리즘 Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 7번 def solution(money): coin = [10, 50, 100, 500, 1000, 5000, 10000, 50000] counter = 0 idx = len(coin) - 1 while money: counter += money // coin[idx] money %= coin[idx] idx -= 1 return counter money = 2760 ret = solution(money) print("solution 함수의 반환 값은", ret, "입니다.") ※ 가끔 코드 중 print(~)가..

문제 유형 코딩 난이도 easy Note Nothing Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 6번 def solution(commands): answer = [] x = 0 y = 0 list_commands = list(commands) for i in list_commands: if i == 'L': x -= 1 elif i == 'R': x += 1 elif i == 'U': y += 1 else: y -= 1 answer.append(x) answer.append(y) return answer commands = "URDDL" ret = solution(commands) print("solution 함수의 반환 ..

문제 유형 코딩 난이도 normal Note 1. 오르막길 횟수를 count하는 배열 놓기. (내리막길을 카운트할 필요는 없음) 2. 해당 배열의 max값을 찾기 Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 5번 def solution(arr): answer = 0 idx = 0 tmp = [0 for i in range(len(arr)-1)] for i in range(len(arr)-1): if arr[i] < arr[i+1]: tmp[idx] += 1 else: idx += 1 answer = max(tmp)+1 if answer < 2: return 1 return answer arr = [3, 1, 2, 4, 5, 1..

문제 유형 코딩 난이도 (주관적인) hard Note 1. Combination(조합). 배열의 원소들 중 3개를 택하여 더하여 K배수가 되는지 확인. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 4번 def solution(arr, K): answer = 0 for i in range(len(arr)-2): for j in range(i+1, len(arr)-1): for k in range(j+1, len(arr)): if (arr[i]+arr[j]+arr[k])%K == 0: answer += 1 return answer arr = [1, 2, 3, 4, 5] K = 3 ret = solution(arr, K) print..

문제 유형 빈칸 난이도 easy Note 1. 문제를 빠르게 이해할 것. 차례대로 읽지 말고 문제를 적당히 읽고 예시를 본다. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 3번 def func_a(n): ret = 1 while n > 0: ret *= 10 n -= 1 return ret def func_b(n): ret = 0 while n > 0: ret += 1 n //= 10 return ret def func_c(n): ret = 0 while n > 0: ret += n%10 n //= 10 return ret def solution(num): next_num = num while True: next_num += ..

문제 유형 빈칸 난이도 easy Note Nothing Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 2번 def func_a(times): hour = int(times[:2]) minute = int(times[3:]) return hour*60 + minute def solution(subway_times, current_time): current_minute = func_a(current_time) INF = 1000000000 answer = INF for s in subway_times: subway_minute = func_a(s) if subway_minute>=current_minute: answer = subw..

문제 유형 빈칸 난이도 easy Note 1. 파이썬의 Class, def, self Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 2차 1번 from abc import * class Book(metaclass=ABCMeta): @abstractmethod def get_rental_price(self, day): pass class ComicBook(Book): def get_rental_price(self, day): cost = 500 day -= 2 if day > 0: cost += 200*day return cost class Novel(Book): def get_rental_price(self, day): cost = ..

문제 유형 한줄 수정 난이도 easy Note Nothing Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean def solution(prices): INF = 1000000001; tmp = INF answer = -INF for price in prices: if tmp != INF: answer = max(answer, price - tmp) tmp = min(tmp, price) return answer prices1 = [1, 2, 3]; ret1 = solution(prices1); print("solution 함수의 반환 값은", ret1, "입니다.") prices2 = [3, 1]; ret2 = solution(prices2..