일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- join
- 크루스칼
- 다시
- 시뮬레이션
- 누적합
- 백트래킹
- 해시
- MST
- 트리
- 구현
- 다이나믹 프로그래밍
- 재귀
- 서브쿼리
- 수학
- 브루트포스
- GROUP BY
- 플로이드-워셜
- 다익스트라
- 분할정복
- DP
- 우선순위큐
- 자료구조
- 다이나믹프로그래밍
- 그래프 탐색
- 에라토스테네스의 체
- 그래프 이론
- DFS
- BFS
- 그리디
- 투포인터
- Today
- Total
목록전공/프로그래머스 (34)
기록하고 까먹지 말기

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 def solution(fees, records): check = dict() # 입차, 출차 체크 parktime = dict() # 차량별 주차시간 res = dict() for i in range(len(records)): tmp, num, inout = records[i].split() hh, mm = tmp.split(":") time = int(hh) * 60 + int(mm) records[i] = [time, num, inout] if num not in check: check[num] = -1 parktime[num] = 0 res[num] = 0 for i in range(len(records)): time, num,..

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 오답코드 def solution(booktime): def timediff(before, after): hour = int(after[0]) - int(before[0]) minute = int(after[1]) - int(before[1]) if minute < 0: hour -= 1 minute += 60 return hour * 60 + minute time = list() for start, end in booktime: start = list(start.split(":")) end = list(end.split(":")) time.append([int(start[0]), int(start[1]), timediff(start, ..

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 def solution(picks, minerals): check = list() # 우선순위 리스트 pick = picks[0] + picks[1] + picks[2] if len(minerals) > pick * 5: # 현재 있는 곡괭이로 캘 수 없는 광물들 생략 minerals = minerals[:pick * 5] for i in range(0, len(minerals), 5): tmp = 0 for j in range(i, i + 5): if j not in range(len(minerals)): break if minerals[j] == "diamond": tmp += 25 elif minerals[j] == "iron":..

날짜 : 2023. 10. 12 사용 언어 : python 문제 코드 def solution(plans): def time_cal(a, b): # b와 a 시간계산(분) hour = (b[0] - a[0]) minute = (b[1] - a[1]) if minute < 0: hour -= 1 minute += 60 return hour * 60 + minute res = list() arr = list() for sub, time, cost in plans: # 전처리 h, m = time.split(":") arr.append([sub, int(h), int(m), int(cost)]) arr.sort(key = lambda x : (x[1], x[2])) # 시간 순으로 정렬 rest = list()..

날짜 : 2023. 10. 10 사용 언어 : python 문제 코드 import heapq INF = int(1e9) def solution(operations): maxheap = list() minheap = list() hash = dict() cnt = 0 # 전체 큐에 남아있는 원소의 개수 for temp in operations: op, num = temp.split() num = int(num) if op == "I": # 삽입 cnt += 1 heapq.heappush(minheap, num) heapq.heappush(maxheap, num * (-1)) if num not in hash: hash[num] = 1 else: hash[num] += 1 continue if cnt == ..

날짜 : 2023. 10. 09 사용 언어 : python 문제 코드 다익스트라 import heapq INF = int(1e9) def solution(n, s, a, b, fares): graph = [[] for _ in range(n + 1)] for edge in fares: # 각 노드와 연결된 edge 체크 p, q, cost = edge graph[p].append([q, cost]) graph[q].append([p, cost]) def dijkstra(start, end): dist = [INF] * (n + 1) dist[start] = 0 # 현재노드 queue = list() heapq.heappush(queue, [0, start]) while queue: d, now = hea..

날짜 : 2023. 10. 08 사용 언어 : python 문제 코드 def solution(info, edges): visited = [False] * len(info) # 방문처리 res = list() visited[0] = True res.append(1) def dfs(sheep, wolf): if sheep > wolf: res.append(sheep) else: return for start, end in edges: if visited[start] and not visited[end]: # 부모노드 방문 완료, 자식노드 탐색 visited[end] = True # 방문처리 if info[end] == 0: # 자식이 양 dfs(sheep + 1, wolf) else: dfs(sheep, w..

날짜 : 2023. 10. 07 사용 언어 : oracle 문제 코드 -- 조회수가 가장 높은 중고거래 게시물에 대한 첨부파일 경로를 조회 -- 첨부파일 경로는 FILE ID를 기준으로 내림차순 정렬 -- 기본적인 파일경로는 /home/grep/src/ -> 기본경로/게시글ID/파일ID/파일이름/확장자 -- 게시글 ID를 기준으로 디렉토리가 구분되고, 파일이름은 파일 ID, 파일 이름, 파일 확장자로 구성되도록 출력 SELECT '/home/grep/src/'||B.BOARD_ID||'/'||B.FILE_ID||B.FILE_NAME||B.FILE_EXT AS FILE_PATH FROM ( SELECT * FROM ( SELECT * FROM USED_GOODS_BOARD ORDER BY VIEWS DES..