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

날짜 : 2023. 10. 04 사용 언어 : python 문제 코드 def solution(graph): dist = len(graph) def check(r, c, length): # print(r, c, length) if length == 0: return flag = graph[r][c] # 기준값 저장 for i in range(r, r + length): for j in range(c, c + length): if flag != graph[i][j]: # 압축 불가능 -> 재귀 check(r, c, length // 2) check(r, c + length // 2, length // 2) check(r + length // 2, c, length // 2) check(r + length /..

날짜 : 2023. 10. 04 사용 언어 : oracle 문제 코드 -- 생산일자가 2022년 5월인 식품들의 식품 ID, 식품 이름, 총매출을 조회 -- 결과는 총매출을 기준으로 내림차순 정렬 -- 총매출이 같다면 식품 ID를 기준으로 오름차순 정렬 select a.product_id, a.product_name, a.price * b.total_amount as total_sales from food_product a join ( select product_id, sum(amount) as total_amount from food_order where to_char(produce_date, 'yyyymm') = '202205' group by product_id ) b on a.product_id ..

날짜 : 2023. 10. 03 사용 언어 : python 문제 코드 def solution(n): tri = [[-1] * 1001 for _ in range(1001)] for i in range(n): for j in range(i + 1): tri[i][j] = 0 r, c, d = 0, 0, 0 dx = [1, 0, -1] dy = [0, 1, -1] tri[r][c] = 1 # 시작점 cnt = 1 while cnt < (n * (n + 1) // 2): cnt += 1 # 카운트 증가 nx = r + dx[d] # 다음 좌표 ny = c + dy[d] if tri[nx][ny] != 0: # 이미 접근했거나 범위를 이탈 d = (d + 1) % 3 # 방향 전환 nx = r + dx[d] #..

날짜 : 2023. 10. 03 사용 언어 : python 문제 코드 def solution(tri): r = len(tri) res = [[0] * i for i in range(1, len(tri) + 1)] res[0] = tri[0] for i in range(len(tri)-1): for j in range(i + 1): now = res[i][j] left = tri[i+1][j] # 왼쪽 아래의 수 res[i+1][j] = max(now + left, res[i+1][j]) right = tri[i+1][j+1] # 오른쪽 아래의 수 res[i+1][j+1] = max(now + right, res[i+1][j+1]) # for i in res: # print(i) return max(res..

날짜 : 2023. 10. 03 사용 언어 : oracle 문제 코드 -- 식품분류별로 가격이 제일 비싼 식품의 분류, 가격, 이름을 조회 -- 식품분류가 '과자', '국', '김치', '식용유'인 경우만 -- 결과는 식품 가격을 기준으로 내림차순 정렬 select category, price as max_price, product_name from food_product where (category, price) in ( select category, max(price) from food_product group by category ) and category in ('과자', '국', '김치', '식용유') order by max_price desc ; 풀이 - 각 카테고리별 최대 가격을 만드는 서브..

날짜 : 2023. 10. 03 사용 언어 : oracle 문제 코드 -- 서울에 위치한 식당들의 식당 ID, 식당 이름, 음식 종류, 즐겨찾기수, 주소, 리뷰 평균 점수 -- 리뷰 평균점수는 소수점 세 번째 자리에서 반올림 -- 결과는 평균점수를 기준으로 내림차순 정렬 -- 평균점수가 같다면 즐겨찾기수를 기준으로 내림차순 정렬 select a.rest_id, a.rest_name, a.food_type, a.favorites, a.address, b.score from rest_info a join (select rest_id, round(avg(review_score), 2) as score from rest_review group by rest_id) b on a.rest_id = b.rest_id..

날짜 : 2023. 10. 01 사용 언어 : python 문제 코드 from collections import deque def solution(n, wires): def bfs(idx): queue = deque() queue.append(1) visited = [False] * (n + 1) visited[1] = True cnt = 0 while queue: now = queue.popleft() cnt += 1 for i in range(len(wires)): if i == idx: continue # 사용 불가능한 와이어 if now in wires[i]: # 방문 x, 경로에 있는 경우 if now == wires[i][0] and not visited[wires[i][1]]: visited..

날짜 : 2023. 10. 01 사용 언어 : oracle 문제 코드 -- 7월 아이스크림 총 주문량과 상반기의 아이스크림 총 주문량을 더한 값이 큰 순서대로 상위 3개의 맛을 조회 select flavor from ( select a.flavor, a.total_order + b.total_order from first_half a join ( select flavor, sum(total_order) as total_order from july group by flavor ) b on a.flavor = b.flavor order by a.total_order + b.total_order desc ) where rownum < 4 ; 풀이 - july 테이블의 flavor는 first_half 테이블의..