전체 글 116

[코드트리 삼성 기출] 윷놀이 사기단 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/woodstick-fraud/description 코딩테스트 기출 문제 설명: 윷놀이 사기단 | 코드트리코딩테스트 기출 문제 윷놀이 사기단의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai def move(idx, val, i): new_val = destination[val] if val not in blue_points else destination[-val] for _ in range(arr[idx]-1): # print(new_val) if new_val >= 32: ..

CS/알고리즘 2026.09.18

[코드트리 삼성 기출] 방화벽 설치하기 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/firewall-installation/description 코딩테스트 기출 문제 설명: 방화벽 설치하기 | 코드트리코딩테스트 기출 문제 방화벽 설치하기의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from collections import dequeN, M = map(int, input().split())area = [input().split() for _ in range(N)]empty, fire, walls = [], [], []for i in range(N): for j in range(M): v..

CS/알고리즘 2026.09.13

[코드트리 삼성 기출] 테트리스 블럭 안의 합 최대화 하기 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/max-sum-of-tetris-block/description 코딩테스트 기출 문제 설명: 테트리스 블럭 안의 합 최대화 하기 | 코드트리코딩테스트 기출 문제 테트리스 블럭 안의 합 최대화 하기의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from sys import stdindef int_input(): return map(int, stdin.readline().split())N, M = int_input()arr = [list(int_input()) for _ in range(N)]dy, dx = (-1, 1, ..

CS/알고리즘 2026.09.12

[코드트리 삼성 기출] 디버깅 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/debugging/description 코딩테스트 기출 문제 설명: 디버깅 | 코드트리코딩테스트 기출 문제 디버깅의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from sys import stdin# i 번 줄의 결과는 무조건 i번으로 가야 함# 최소한의 선을 추가해 버그 없애기def minus_one(num): return int(num) - 1def int_input(func=int): return map(func, stdin.readline().split())def choose(level, start): ..

CS/알고리즘 2026.09.06

[코드트리 삼성 기출] 방화벽 설치하기 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/firewall-installation/description 코딩테스트 기출 문제 설명: 방화벽 설치하기 | 코드트리코딩테스트 기출 문제 방화벽 설치하기의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from collections import dequeN, M = map(int, input().split())area = [input().split() for _ in range(N)]empty, fire = [], []for i in range(N): for j in range(M): val = area[i]..

CS/알고리즘 2026.09.05

[코드트리 삼성 기출] 마법의 숲 탐색 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/magical-forest-exploration/description 코딩테스트 기출 문제 설명: 마법의 숲 탐색 | 코드트리코딩테스트 기출 문제 마법의 숲 탐색의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from sys import stdinfrom collections import dequedef int_input(): return map(int, stdin.readline().split())def in_range(y, x): return 0

CS/알고리즘 2026.09.04

[코드트리] 연속한 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