전체보기
-
-
2022 KAKAO TECH INTERNSHIP 코딩 테스트 공부코딩 테스트/Level 3 2022. 11. 20. 23:31
https://school.programmers.co.kr/learn/courses/30/lessons/118668 https://tech.kakao.com/2022/07/13/2022-coding-test-summer-internship/ def solution(alp, cop, problems): max_alp = max_cop = 0 for each_alp, each_cop, *_ in problems: max_alp = max(each_alp, max_alp) max_cop = max(each_cop, max_cop) dp = [[float('inf') for _ in range(max_cop + 1)] for _ in range(max_alp + 1)] alp, cop = min(alp, max..
-
라즈베리 파이 피코 W 내장 LED가 작동하지 않을 때라즈베리 파이 피코 2022. 11. 19. 13:31
Pico W onboard LED not working import machine import utime led_onboard = machine.Pin("LED", machine.Pin.OUT) while True: led_onboard.toggle() utime.sleep(.5) https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf 3.4. The on-board LED Unlike the original Raspberry Pi Pico, the on-board LED on Pico W is not connected to a pin on RP2040, but instead to a GPIO pin on th..
-
프로그래머스 / 기사단원의 무기코딩 테스트/Level 1 2022. 11. 17. 19:14
https://school.programmers.co.kr/learn/courses/30/lessons/136798 파이썬 약수는 제곱근(루트)를 이용해서 계산을 줄일 수 있다. def solution(number, limit, power): answer = 0 for i in range(1, number + 1): sqrt_i = i ** .5 count = sum(1 for j in range(1, int(sqrt_i) + 1) if i % j == 0) * 2 - (0 if sqrt_i % 1 else 1) answer += power if limit < count else count return answer 코틀린 class Solution { fun solution(number: Int, lim..
-
최적의 행렬 곱셈코딩 테스트/Level 3 2022. 11. 17. 01:35
https://school.programmers.co.kr/learn/courses/30/lessons/12942 def solution(matrix_sizes): table = [[0 for _ in matrix_sizes] for _ in matrix_sizes] for i in range(1, len(matrix_sizes)): for j in range(len(matrix_sizes) - i): k = j + i table[j][k] = min( table[j][m] + table[m + 1][k] + matrix_sizes[j][0] * matrix_sizes[m][1] * matrix_sizes[k][1] for m in range(j, k)) return table[0][-1]
-
등산코스 정하기코딩 테스트/Level 3 2022. 11. 16. 17:55
https://school.programmers.co.kr/learn/courses/30/lessons/118669 다익스트라 알고리듬의 변형이다. from collections import defaultdict from heapq import heappop, heappush def solution(n, paths, gates, summits): summits_set = set(summits) graph = defaultdict(list) for i, j, w in paths: graph[i].append((j, w)) graph[j].append((i, w)) gates_queue = [(0, gate) for gate in gates] intensities = [float('inf') for _ in..
-
부대복귀코딩 테스트/Level 3 2022. 11. 16. 13:18
https://school.programmers.co.kr/learn/courses/30/lessons/132266 destination에서 출발해서 각각의 부대로 도착하는 거리를 측정하는 것이 더 쉽다. 최단 거리이므로 너비 우선 탐색을 응용하면 된다. from collections import defaultdict, deque def solution(n: int, roads: list, sources: list, destination: int): graph = defaultdict(set) for v1, v2 in roads: graph[v1].add(v2) graph[v2].add(v1) visited = {} queue = deque() # queue = deque([(destination, 0)..
-
숫자 카드 나누기코딩 테스트/Level 2 2022. 11. 10. 22:40
https://school.programmers.co.kr/learn/courses/30/lessons/135807 gcd를 이용하면 통과. from math import gcd def solution(nums1, nums2): gcd1, gcd2 = nums1[0], nums2[0] for each1, each2 in zip(nums1[1:], nums2[1:]): gcd1, gcd2 = gcd(each1, gcd1), gcd(each2, gcd2) answer = [] for each1 in nums1: if each1 % gcd2 == 0: break else: answer.append(gcd2) for each2 in nums2: if each2 % gcd1 == 0: break else: ans..