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','-'], |