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

날짜 : 2023. 10. 01 사용 언어 : oracle 문제 코드 -- 입양을 간 동물 중, 보호 기간이 가장 길었던 동물 두 마리의 아이디와 이름을 조회하는 SQL문 -- 결과는 보호 기간이 긴 순으로 조회 select * from ( select a.animal_id, a.name -- 아이디, 이름 출력 from animal_ins a join animal_outs b on a.animal_id = b.animal_id order by (b.datetime - a.datetime + 1) desc -- 보호기간이 긴 순으로 정렬 ) where rownum < 3 ; 풀이 - 보호기간을 계산한 다음, 해당 데이터를 내림차순으로 정렬하여 서브쿼리를 작성한다. - 그 다음 해당 테이블을 토대로 2개 ..

날짜 : 2023. 10. 01 사용 언어 : oracle 문제 코드 -- 중성화된 동물은 SEX_UPON_INTAKE 컬럼에 'Neutered' 또는 'Spayed'라는 단어 -- 동물의 아이디와 이름, 중성화 여부를 아이디 순으로 조회하는 SQL문 -- 중성화가 되어있다면 'O', 아니라면 'X'라고 표시 select animal_id, name, case when sex_upon_intake like 'Neutered%' then 'O' -- 중성화 조건 when sex_upon_intake like 'Spayed%' then 'O' else 'X' end as "중성화" from animal_ins order by animal_id asc -- 아이디 순으로 조회 ; 풀이 - 중성화가 되어있는 경..

날짜 : 2023. 10. 01 사용 언어 : oracle 문제 코드 -- 평균 대여 기간이 7일 이상인 자동차들의 자동차 ID와 평균 대여 기간(컬럼명: AVERAGE_DURATION) -- 평균 대여 기간은 소수점 두번째 자리에서 반올림 -- 결과는 평균 대여 기간을 기준으로 내림차순 정렬해주시고, -- 평균 대여 기간이 같으면 자동차 ID를 기준으로 내림차순 정렬 select car_id, round(avg(end_date - start_date + 1), 1) as average_duration from car_rental_company_rental_history group by car_id having round(avg(end_date - start_date + 1), 1) >= 7 order ..

날짜 : 2023. 09. 30 사용 언어 : python 문제 코드 import sys def bt(idx, path): if len(path) == m: if path not in res: res.append(path) return for i in range(idx, n): bt(i, path + [a[i]]) return n, m = map(int, sys.stdin.readline().split()) a = list(map(int, sys.stdin.readline().split())) a.sort() # print(a) res = list() bt(0, []) res.sort() for i in res: print(*i) 풀이 - 기본적인 백트래킹을 활용한 문제 - 조건에 따라 입력받은 후 해당..

날짜 : 2023. 09. 29 사용 언어 : python 문제 코드 import sys k = int(sys.stdin.readline()) def binary(n): s = "" while n > 0: s += str(n % 2) n = n // 2 s = s[::-1] return s[1:] tmp = binary(k+1) res = "" for i in tmp: if i == "0": res += "4" else: res += "7" print(res) 풀이 - 입력받은 K에 대해 4, 7만으로 구성된 수를 만드는 과정은 다음과 같다. - (K + 1)을 2진수로 만든 후, 해당 수에서 가장 좌측의 수를 제외한 값에서 각각 0을 4로, 1을 7로 변환하여 리턴한다. 알게된 점 - 맨 처음 K에 대..

날짜 : 2023. 09. 29 사용 언어 : python 문제 코드 def solution(tickets): used = [False] * len(tickets) # 사용여부 res = list() def dfs(now, path): # print(now, path) if len(path) == len(tickets) + 1: res.append(path) return for i in range(len(tickets)): if not used[i] and tickets[i][0] == now: # 현재 체크하는 티켓 사용 x, 출발지가 동일 used[i] = True # 사용체크 dfs(tickets[i][1], path + [tickets[i][1]]) # 리스트간 더하기 used[i] = False..

날짜 : 2023. 09. 28 사용 언어 : python 문제 코드 from collections import deque def solution(graph): n, m = len(graph), len(graph[0]) for i in range(n): for j in range(m): if graph[i][j] == 1: graph[i][j] = 0 else: graph[i][j] = 1 answer = 0 queue = deque() queue.append([0, 0]) dx = [0, 0, 1, -1] dy = [1, -1, 0, 0] while queue: x, y = queue.popleft() if x == (n-1) and y == (m-1): return graph[x][y] + 1 for..

날짜 : 2023. 09. 28 사용 언어 : oracle 문제 코드 -- 완료된 중고 거래의 총금액이 70만 원 이상인 사람의 회원 ID, 닉네임, 총거래금액을 조회 -- 결과는 총거래금액을 기준으로 오름차순 정렬 select b.user_id, b.nickname, sum(a.price) as total_sales from used_goods_board a join used_goods_user b on a.writer_id = b.user_id where a.status = 'DONE' group by b.user_id, b.nickname having sum(a.price) >= 700000 order by total_sales asc; 풀이 - 중고거래 게시물과 중고거래 사이트 유저간 각각 wri..