전체 글 110

[코드트리] 연속한 K개의 숫자 풀이 (Python)

https://www.codetree.ai/ko/trails/complete/curated-cards/challenge-k-numbers-in-a-row/description 연속한 K개의 숫자 설명 | 코드트리연속한 K개의 숫자의 요구사항을 정확히 분석하고, 적절한 알고리즘을 고안해 두 번째 단계 중급 문제를 해결해보세요.www.codetree.ai N, K, B = map(int, input().split())numbers = [1] * (N+1)for _ in range(B): numbers[int(input())] = 0for i in range(2, N+1): numbers[i] += numbers[i-1]min_cnt = K - numbers[K]for i in range(K+1, ..

CS/알고리즘 2026.08.30

[코드트리 삼성 기출] 메이즈 러너 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/maze-runner/description 코딩테스트 기출 문제 설명: 메이즈 러너 | 코드트리코딩테스트 기출 문제 메이즈 러너의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai def minus_one(num): return int(num) - 1def int_input(func=int): return map(func, input().split())def calc_dist(y1, x1, y2, x2): return abs(y1 - y2) + abs(x1 - x2)def in_range(y, x): ret..

CS/알고리즘 2026.08.28

[코드트리] 선분 위의 점 풀이 (Python)

https://www.codetree.ai/ko/trails/complete/curated-cards/challenge-point-on-the-line-segment/description 선분 위의 점 설명 | 코드트리선분 위의 점의 요구사항을 정확히 분석하고, 적절한 알고리즘을 고안해 두 번째 단계 중급 문제를 해결해보세요.www.codetree.ai from sys import stdindef int_input(): return map(int, stdin.readline().split())n, m = int_input()arr = sorted(int_input())def binary_search(target, type_of): start, end = 0, n-1 if type_of =..

CS/알고리즘 2026.08.22

[코드트리] 범위 내에 있는 점의 수 2 풀이 (Python)

https://www.codetree.ai/ko/trails/complete/curated-cards/challenge-the-number-of-points-within-the-range-2/description 범위 내에 있는 점의 수 2 설명 | 코드트리범위 내에 있는 점의 수 2의 요구사항을 정확히 분석하고, 적절한 알고리즘을 고안해 두 번째 단계 중급 문제를 해결해보세요.www.codetree.ai from sys import stdindef int_input(): return map(int, stdin.readline().split())n, q = int_input()points = sorted(int_input())# Please write your code here.limit = in..

CS/알고리즘 2026.08.14

[코드트리 삼성 기출] 개구리의 여행 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/frog-journey/description 코딩테스트 기출 문제 설명: 개구리의 여행 | 코드트리코딩테스트 기출 문제 개구리의 여행의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from heapq import heappush, heappopdef minus_one(num): return int(num) - 1def minus_one_input(): return map(minus_one, input().split())def in_range(y, x): return 0 jump: ..

CS/알고리즘 2026.08.08

[코드트리 삼성기출] 예술성 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/artistry/description 코딩테스트 기출 문제 설명: 예술성 | 코드트리코딩테스트 기출 문제 예술성의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from collections import dequedef in_range(y, x): return 0 num: _, _, new_color, _, new_cnt = group_info[key - 1] result = (cnt + new_cnt) * color * new_color * around[key] ..

CS/알고리즘 2026.07.31

[코드트리 삼성 기출] 회전하는 빙하 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/rotating-glacier/description 코딩테스트 기출 문제 설명: 회전하는 빙하 | 코드트리코딩테스트 기출 문제 회전하는 빙하의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai def int_input(): return map(int, input().split())def in_range(y, x): return 0 = 2: path.append((y, x)) for y, x in path: area[y][x] -= 1 return len(p..

CS/알고리즘 2026.07.25

[코드트리 삼성 기출] 격자 숫자 놀이 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/matrix-number-play/description 코딩테스트 기출 문제 설명: 격자 숫자 놀이 | 코드트리코딩테스트 기출 문제 격자 숫자 놀이의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai def main(): def int_input(func=int): return map(func, input().split()) r, c, k = int_input(lambda x: int(x) - 1) arr = [list(int_input()) for _ in range(3)] k += 1 ..

CS/알고리즘 2026.07.19