일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 계수정렬
- ADsP
- 기러기목
- 딱다구리과
- 직박구리과
- AI역량평가
- 참새과
- python3
- 한국의새
- 오리과
- keras
- 흰날개해오라기
- 가마우지과
- 비둘기목
- AI전략게임
- 솔딱새과
- django
- Python
- SimpleCraft
- 딥러닝공부
- 생일문제
- IBK기업은행 인턴
- 참새목
- 비둘기과
- structured_array
- 백로과
- 딥러닝 공부
- Birthday paradox
- 맑은소리 스피치학원
- 한국의 새
- Today
- Total
목록전체 글 (121)
진박사의 일상
문제 : 문자열을 N개 단위로 잘라 반복된 시퀀스와 그 반복 횟수로 나타내 줄이는 압축을 할 때 최대로 압축한 문자열의 길이는? def solution(s): answer = 0 if len(s) == 1: return 1 half_l = len(s)//2 # 8 -> 4 for size in range(1,half_l+1): # 1-4 #split size word = "" count = 0 for start in range(0,len(s),size): # size=1일때 0-7, 2일때 0-6 now_seq = s[start:start+size] #현재 분할 next_seq = s[start+size:start+size*2] #다음 분할 before_seq = [] #이전 분할 if start-siz..
문제 : 오픈채팅방의 입출입 및 닉네임 변경 내역을 입력받아 채팅방에 표시되는 로그를 출력하라(단 사용자는 uid로 구별하고... 아몰라 찾아보셈(...) from collections import defaultdict def solution(record): answer = [] messages = defaultdict(list) index = 0 for r in record: if len(r.split()) == 3: command, uid, name = r.split() else: command, uid = r.split() if len(uid) > 10: continue if len(name) > 10: continue if command == "Enter": if messages[uid]: mes..
문제 : 배열을 i부터 j 까지 자르고 정렬한 다음 k번째 수를 찾아라 def solution(array, commands): answer = [] print(array) for command in commands: arr = array[ command[0] - 1 : command[1]] arr.sort() answer.append(arr[command[2]-1]) return answer 파이썬 기본 기능만 충실히 잘 써도 너무나 쉽게 풀리는 문제(slicing, sort 등)
문제 : 모든 문제를 찍는 사람의 패턴 + 문제 정답이 주어질 때 제일 점수가 잘 나온 사람은? def solution(answers): answer = [] score = [0,0,0] students = [[1,2,3,4,5],[2, 1, 2, 3, 2, 4, 2, 5],[3, 3, 1, 1, 2, 2, 4, 4, 5, 5]] i = 0 for a in answers: if a == students[0][i % 5]: score[0] += 1 if a == students[1][i % 8]: score[1] += 1 if a == students[2][i % 10]: score[2] += 1 i += 1 print(score) answer = [i+1 for i in range(3) if score[..
문제 : 복싱선수 정렬하기 def solution(weights, head2head): answer = [] win_rate = [man.count('W')/(len(man)-man.count('N')) if len(man)-man.count('N') != 0 else 0 for man in head2head] win_bigger_cnt = [len(["" for x, y in enumerate(man) if y == 'W' and weights[x] > weights[idx]]) for idx, man in enumerate(head2head)] print(win_rate) print(win_bigger_cnt) print(weights) return sorted(list(range(1,len(weig..
문제 : 상하좌우. NxN 범위에서 상하좌우 입력을 받아 이동 후 좌표를 구하라. (LRUD 입력, 벽에 막히면 무시) n = int(input()) directions = list(input().split()) index = [1,1] for d in directions: if d == 'L': index[1] -= 1 elif d == 'R': index[1] += 1 elif d == 'U': index[0] -= 1 elif d == 'D': index[0] += 1 else: pass if index[0] n-1: index[0] = n-1 elif index[1] n-1: ..