K

@kimjuha19

로봇 부품 재고 관리

Python
3 months ago
parts = ["M1", "S2", "M1", "M1", "B3", "S2"] limit = 2 answer = [] count = 1 parts.sort() for i in range(len(parts)-1): if parts[i] == parts[i+1]: count += 1 if count > limit:

드론 비행 고도 매칭

Python
3 months ago
drone_a = [10, 20, 35, 50, 80] drone_b = [15, 25, 30, 60, 90] target = 10 total = [] answer = [] for i in range(len(drone_a)): for j in range(len(drone_b)): if drone_a[i] - drone_b[j] == target or drone_b[j] - drone_a[i] == target:

명령어 조합 최적화

Python
3 months ago
apps = [("Music", 200, 50), ("AI", 500, 90), ("Weather", 100, 30)] limit = 600 total = 0 answer = 0 for i in range(len(apps)-1): if apps[i][1] + apps[i+1][1] == limit: answer = apps[i][2] + apps[i+1][2] else: total = 0

멀티 마이크 위상차 계산

Python
3 months ago
mic_a = [1, 2, 3, 4] mic_b = [4, 1, 2, 3] delay = 0 for i in range(len(mic_b)): if mic_a == mic_b: print(delay) break else: mic_b = mic_b[1:] + mic_b[:1]

스마트 비서 질문 의도 파악

Python
3 months ago
commands = ["music play", "music stop", "weather today", "alarm set"] input = "mus" answer = [] for i in range(len(commands)): if input in commands[i]: answer.append(commands[i]) print(answer)

마이크 주변 소음 제거

Python
3 months ago
import statistics audio = [10, 2, 100, 3, 8, 10, 7] k = 3 start = 1 total = audio[start:start+k] median_val = statistics.median(total) audio[k-1] = median_val

음성 신호 데이터의 압축

Python
3 months ago
signal = [0, 0, 0, 120, 120, 150, 150, 150, 150, 80] answer = [] count = 1 for i in range(0, len(signal)-1): if signal[i] == signal[i+1]: count += 1 else: answer.append([signal[i], count]) count = 1

최적의 작업 우선순위 결정

Python
3 months ago
jobs = [["P1", 5, 5], ["P2", 2, 10], ["P3", 10, 2]] answer = [] max_num = 0 for i in range(0,3): if (jobs[i][1] + jobs[i][2]) // jobs[i][2] > max_num: max_num = (jobs[i][1] + jobs[i][2]) // jobs[i][2] answer.insert(0, jobs[i][0]

가장 먼 노드

Python
3 months ago
from collections import deque n, connections = 6, [[3,6],[4,3],[3,2],[1,3],[1,2],[2,4],[5,2]] graph = [[] for _ in range(n + 1)] for a, b in connections: graph[a].append(b) graph[b].append(a) dist = [-1] * (n + 1)

다리를 지나는 트럭

Python
3 months ago
from collections import deque bridge_length, weight_limit, truck_weights = 2, 10, [7, 4, 5, 6] bridge = deque([0] * bridge_length) current_weight = 0 time = 0 for truck in truck_weights: while True:

파일명 정렬

Python
3 months ago
files = ["img12.png", "img10.png", "img02.png", "img1.png", "IMG01.GIF"] result = sorted(files, key=lambda f: ( __import__('re').match(r'([a-zA-Z\-_.]+)(\d+)', f).group(1).lower(), int(__import__('re').match(r'([a-zA-Z\-_.]+)(\d+)', f).grou

냉장고 식재료 유통기한

Python
3 months ago
items = [["Milk", 2], ["Egg", 5], ["Apple", 2]] items.sort(key=lambda x: (x[1], x[0])) print(items)

보물 상자 비밀번호

Python
3 months ago
max_value = 0 temp = 0 best_combo = () for x in range(1,10): for y in range(1,10): for z in range(1,10): if x+y+z == 15: temp = x*y*z if max_value < temp:

시험 성적 조작 탐지

Python
3 months ago
scores = [50, 55, 60, 95, 100, 98, 70] for i in range(len(scores)-5): avg1 = (scores[i] + scores[i+1] + scores[i+2]) / 3 avg2 = (scores[i+1] + scores[i+2] + scores[i+3]) / 3 if avg2 - avg1 >= 30: print(i+2)

카페 주문 대기 시간

Python
3 months ago
orders = [3, 2, 5, 1] orders.sort(reverse = True) A = [] B = [] for i in orders: if sum(A) <= sum(B): A.append(i) else: B.append(i)

택배 배송 경로의 효율

Python
3 months ago
houses = [0, 5, 2, 10, 8] max_num = max(houses) print(max_num)

스마트 주차장 우선순위(2)

Python
3 months ago
cars = [["일반", 10], ["경차", 11], ["장애인", 12], ["장애인", 11]] classification = ["장애인", "경차", "일반"] answer = [] cars.sort(key=lambda x: x[1]) for i in range(len(classification)): for j in range(len(cars)): if cars[j][0] == classification[i]

스마트 주차장 우선순위

Python
3 months ago
cars = [["일반", 10], ["경차", 11], ["장애인", 12],["장애인", 10]] items = {"장애인":0, "경차":1, "일반":2} cars.sort(key = lambda x:(items[x[0]],x[1])) print(cars)

음원 스트리밍 베스트 장르

Python
3 months ago
sales = [10, 20, 30, 40, 50] queries = [[1, 3], [2, 5]] prefix = [0] for s in sales: prefix.append(prefix[-1] + s) result = []

물류창고 화물 적재

Python
3 months ago
max_weight = 7 items = [[6, 13], [4, 8], [3, 6], [5, 12]] dp = [0] * (max_weight + 1) for weight, value in items: for w in range(max_weight, weight - 1, -1): dp[w] = max(dp[w], dp[w - weight] + value) print(dp[max_weight])