This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go run entgo.io/ent/cmd/ent init <Object(Model) Name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go install entgo.io/ent/cmd/ent | |
// 또는 go get entgo.io/ent/cmd/ent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (l *LifecycleExecution) Run(ctx context.Context, phaseFactoryCreator PhaseFactoryCreator) error { | |
phaseFactory := phaseFactoryCreator(l) | |
var buildCache Cache | |
if l.opts.CacheImage != "" { | |
cacheImage, err := name.ParseReference(l.opts.CacheImage, name.WeakValidation) | |
if err != nil { | |
return fmt.Errorf("invalid cache image name: %s", err) | |
} | |
buildCache = cache.NewImageCache(cacheImage, l.docker) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(numbers, target): | |
answer = 0 | |
value = 0 | |
stack = [0] | |
for idx, number in enumerate(numbers,1): | |
temp = [] | |
while stack: | |
operator = stack.pop() | |
## 모든 숫자를 다 써서 타겟 넘버에 도달할 수 있는 경우 | |
if operator + number == target and idx == len(numbers): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import heapq | |
def solution(n, k, cmd): | |
# 현재 위치: right heap의 첫 번째 원소. | |
left, right, delete = [], [], [] | |
# 왼쪽은 최댓값이 맨 앞에 위치하도록, 오른쪽은 최솟값이 맨 앞에 위치하도록 heap을 구성한다. | |
for i in range(n): | |
heapq.heappush(right, i) | |
for i in range(k): | |
heapq.heappush(left, -heapq.heappop(right)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
def solution(places): | |
dirs = [(0,1), (0,-1), (1,0), (-1,0)] | |
# 맨해튼 거리 체크 메소드 | |
def get_distance(p1, p2): | |
return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1]) | |
def check(p1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(s): | |
table = { | |
"zero" : "0", | |
"one" : "1", | |
"two" : "2", | |
"three" : "3", | |
"four" : "4", | |
"five" : "5", | |
"six" : "6", | |
"seven" : "7", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(skill, skill_trees): | |
skill_set = set(skill) | |
skill_list = list(skill) | |
count = 0 | |
for string in skill_trees: | |
idx = 0 | |
for i in range(len(string)): | |
if string[i] in skill_set: | |
# 순서상 가능한 스킬트리인지 확인 | |
if string[i] == skill_list[idx]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
# 문자열을 sec로 변환하는 메소드 | |
def convert_to_seconds(time): | |
time = map(int, time.split(":")) | |
result = 0 | |
for t, sec in zip(time, [3600, 60, 1]): | |
result += t * sec | |
return result; | |
# sec를 문자열로 반환하는 메소드 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
from itertools import combinations | |
import bisect | |
def solution(info, query): | |
answer = [] | |
table = dict() | |
tmp = [ | |
["cpp","java","python","-"], | |
['backend','frontend','-'], | |
['junior','senior','-'], |