일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 흰날개해오라기
- 참새과
- AI전략게임
- 계수정렬
- structured_array
- Birthday paradox
- 맑은소리 스피치학원
- python3
- 가마우지과
- 참새목
- ADsP
- Python
- 한국의새
- 기러기목
- 한국의 새
- keras
- 비둘기목
- 직박구리과
- 딥러닝 공부
- AI역량평가
- django
- 생일문제
- 솔딱새과
- 오리과
- 딱다구리과
- 백로과
- SimpleCraft
- 딥러닝공부
- IBK기업은행 인턴
- 비둘기과
- Today
- Total
목록프로그래밍/코딩테스트 공부 (26)
진박사의 일상
문제 : 오픈채팅방의 입출입 및 닉네임 변경 내역을 입력받아 채팅방에 표시되는 로그를 출력하라(단 사용자는 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: ..
문제 : n개의 A로 이루어진 문자열을 조이스틱으로 상하좌우 이동하며 주어진 이름을 만드는 최소 횟수를 구하시오. (단 첫번째에서 왼쪽으로 움직이면 맨 오른쪽으로, A에서 위로 움직이면 Z로 이동) def solution(name): answer = 0 n = len(name) alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" updown_count = [0 for _ in range(n)] #알파벳 맞추는 게 어느 방향이 더 빠를지 #알파벳 맞추는 최소 이동 횟수 정하기 for idx, letter in enumerate(name): if alphabet.find(letter) > len(alphabet) - alphabet.find(letter): updown_count[idx]..