SELECT B.CATEGORY 'CATEGORY', SUM(BS.SALES) AS 'TOTAL_SALES'
FROM BOOK_SALES AS BS
LEFT JOIN BOOK AS B ON BS.BOOK_ID = B.BOOK_ID
WHERE BS.SALES_DATE BETWEEN '2022-01-01' AND '2022-01-31'
GROUP BY B.CATEGORY
ORDER BY B.CATEGORY ASC
import heapq
def solution(n, works):
if sum(works) <= n:
return 0
max_heap = []
for time in works:
heapq.heappush(max_heap, -time)
while(n > 0):
max_value = heapq.heappop(max_heap)
heapq.heappush(max_heap,max_value + 1)
n -= 1
sum_time = 0
for time in max_heap:
sum_time += time ** 2
return sum_time
import itertools
def find_available(user, target):
if(len(user) != len(target)): return False
for idx,elem in enumerate(user):
if(target[idx] == '*'): continue
if(target[idx] != elem): return False
return True
def solution(user_id, banned_id):
ban_list = []
for ban in banned_id:
tmp_list = []
for user in user_id:
if(find_available(user,ban)):
tmp_list.append(user)
ban_list.append(tmp_list)
combinations = list(itertools.product(*ban_list))
result = set([])
for elem in combinations:
elem = frozenset(elem)
if(len(elem) == len(banned_id)):
result.add(elem)
return len(result)
from collections import deque
def solution(board):
MAX_ROW = len(board)
MAX_COL = len(board[0])
visited = [[[500 * 25] * 3] * MAX_COL for _ in range(MAX_ROW)]
visited[0][0][1] = 0
visited[0][0][2] = 0
queue = deque([[0,0,0,0]]) # y,x,corner,prev_dir
dxy = [[1,0,1],[-1,0,1],[0,1,2],[0,-1,2]] # 상하 -> dir = -1, 좌우 -> dir = +1
min_total_cost = 25 * 100 + 25 * 500
num_road = 0
while(queue):
for _ in range(len(queue)): # 한 사이클 진행
y,x,num_corner,prev_dir = queue.popleft()
total_cost = num_road * 100 + num_corner * 500
if visited[y][x][prev_dir] < total_cost: continue
visited[y][x][prev_dir] = total_cost
if y == MAX_ROW - 1 and y == MAX_COL - 1: # 종료 조건
if total_cost < min_total_cost:
min_total_cost = total_cost
continue # 계속 다음 진행
for dy,dx,cur_dir in dxy:
ny,nx = y+dy, x+dx
if(not (0 <= ny < MAX_ROW) or not (0 <= nx < MAX_COL)): continue #맵 범위 벗어남
if(board[ny][nx] == 1): continue # 벽이 있어서 진행 불가
queue.append([ny,nx,num_corner+1 if prev_dir + cur_dir == 3 else num_corner,cur_dir])
num_road += 1
return min_total_cost
rsa 파일 받기
puttygen을 이용해서 ppk → pem 변경
권한 변경 (600)
ssh config 파일 설정
NC 소프트 지원서 제출 완료
- 자바 / C++로 코테 본다는데 준비해야 될 듯
토스페이먼츠 구조 파악
결제 요청 → 결제 인증 → 결제 승인 구조로 감.
DB 모델링
일단 예약 주문 건을 고려하지 않고, 일반 주문 건만 고려하여 DB 모델링 진행
추후에 팀원들 피드백 받고, 문제 없으면 해당 형태로 개발이 진행될 예정
Payment 테이블 - 결제 정보를 담고 있는 테이블
Order 테이블 - 실제 주문 정보를 담고 있는 테이블
OrderProduct 테이블 - 주문 상품 정보를 담고 있는 테이블
추후에 결제 플로우는 다음과 같이 진행이 될듯.
프론트에서 결제 요청
서버에서 장바구니 데이터(MongoDB)를 보고 OrderProduct / Order 엔티티 생성
amount / price 등 필수 정보를 프론트로 넘김.
프론트에서 해당 정보를 바탕으로 결제 위젯을 통해 결제 진행 (Payment 객체 생성됨)
서버에서 Payment 객체를 받아서 정보를 저장함. (Payment 엔티티 생성)
추후 웹훅 URL을 통해 결제 상태를 추적해서 업데이트를 진행하는 방식으로 갈 것 같음.
heap 정렬 초기화
heapify(arr)
빈 배열에 heappush로 안에 있는 원소 하나씩 넣기
heap min value 넣기
heap value 넣기