일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- labelsmoothingloss
- 네이버AI부스트캠프
- 네이버 ai 부스트캠프
- autograd
- 우선순위큐
- layernormalization
- noiserobustness
- 밑바닥부터 시작하는 딥러닝
- pytorch
- 중복순열
- BatchNormalization
- Optimizer
- fasterRCNN
- cmp_to_key
- Focal Loss
- ComputerVision
- mmdetectionv3
- ImageClassification
- objectdetection
- l2penalty
- f1loss
- 정렬
- 힙
- 프로그래머스
- clibration
- labelsmoothing
- DataAugmentation
- 자료구조끝판왕문제
- inference
- focalloss
- Today
- Total
목록Coding test (18)
HealthyAI

def solution(key, lock): answer = False n = len(lock) m = len(key) new_lock = [[0] * (n*3) for _ in range(n*3)] for i in range(n): for j in range(n): new_lock[i+n][j+n] = lock[i][j] for rotation in range(4): key = rotate_a_matrix_by_90_degree(key) for x in range(n*2): for y in range(n*2): for i in range(m): for j in range(m): new_lock[x+n][j+n] += key[i][j] if check(new_lock): return True for i ..

조건 동작을 실행 했을 때 주어진 조건들을 모두 만족 하는지 판단 한다. 1. 삭제 -> 만족 못할 시 -> 다시 추가 2. 추가 -> 만족 못할 시 -> 삭제 def possible(answer): for x, y, stuff in answer: if stuff == 0: if y == 0 or [x-1, y, 1] in answer or [x, y-1, 0] in answer or [x, y, 1] in answer: continue return False elif stuff == 1: if ([x-1, y, 1] in answer and [x+1, y, 1] in answer) or [x, y-1, 0] in answer or [x+1, y-1, 0] in answer: continue return..

커트 하려는 줄을 하나씩 선택 하면서 연결되어있는 노드의 수를 비교하며 갱신해 나가 최솟값을 찾는 것이 최종 목표이다. BFS를 이용하여 각 노드에 연결된 노드를 탐색한다. from collections import defaultdict, deque def bfs(d_line, graph, n): visited = [False] * (n+1) visited[d_line[0]] = True queue = deque([d_line[0]]) cnt = 1 while queue: cur = queue.popleft() for i in graph[cur]: if visited[i] or i == d_line[1]: continue visited[i] = True cnt += 1 queue.append(i) ret..

범위가 1000을 넘지 않는 다면 파이썬 내장 모듈 itertools의 순열, 조합 함수를 사용해본다. from itertools import permutations def solution(k, dungeons): answer = [] for p in permutations(dungeons, len(dungeons)): # k 는 순열 조합들에 모두 사용하며 초기화 시켜야되므로 따로 저장한다. life = k cnt = 0 for start, waste in p: if start

def solution(brown, yellow): tot = brown + yellow for i in range(3, int(tot ** 0.5) + 1): # 한 변의 길이는 2보다 커야 된다. if tot % i == 0: a = i b = tot / a # 두 변에서 2 씩 뺀 길이의 합에 2배를 하면 갈색 타일의 모퉁이를 제외한 개수를 알수 있다. if brown - 4 == (a-2+b-2) * 2: return [b, a]

주어진 문자에서 문자열로 구성된 리스트를 만든다. 해당 리스트의 순열 연산으로 만들 수 있는 숫자들을 set 함수로 모두 집합 안에 나타내는 함수를 만든다. 집합 안에 있는 숫자들을 반복문을 돌며 하나씩 소수 인지 판별할 수 있도록 소수 판별 함수를 만든다. 주어진 문자열로 만들 수 있는 숫자를 모두 소수 판별 하며 세어준다. from itertools import permutations def solution(numbers): answer = 0 nums = list(numbers) num_set = makenum(nums) for num in num_set: if decideWholeNum(num): answer += 1 return answer def makenum(num_lst): nums = s..

학생들 점수의 인덱스는 정답의 인덱스를 학생들 점수의 반복되는 점수의 길이만큼 나눠준 나머지로 한다. student_index = answers_i % len(student) def solution(answers): answer = [] first = [1,2,3,4,5] second = [2,1,2,3,2,4,2,5] third = [3,3,1,1,2,2,4,4,5,5] score = [0,0,0] for i in range(len(answers)): if answers[i] == first[i % len(first)]: score[0] += 1 if answers[i] == second[i % len(second)]: score[1] += 1 if answers[i] == third[i % len(t..

5개 밖에 안되는 알파벳이 주어졌으므로 itertools 내장 모듈의 중복 순열 product를 이용해본다. from itertools import product def solution(word): answer = 0 lst = [] for i in range(1, 6): for j in product(['A', 'E', 'I', 'O', 'U'], repeat = i): lst.append(''.join(j)) lst.sort() return lst.index(word) + 1