전체 글 108

[코드트리] 선분 위의 점 풀이 (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

[코드트리 삼성 기출] 이상한 다트 게임 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/odd-dart-game/description 코딩테스트 기출 문제 설명: 이상한 다트 게임 | 코드트리코딩테스트 기출 문제 이상한 다트 게임의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from collections import dequedef int_input(): return map(int, input().split())def fill_minus_set(): minus_set = set() for j in range(M): number = arr[0][j] if number:..

CS/알고리즘 2026.07.18

[코드트리 삼성 기출] 보도플럭 풀이 (Python)

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/crosswalk/description 코딩테스트 기출 문제 설명: 보도블럭 | 코드트리코딩테스트 기출 문제 보도블럭의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai def int_input(): return map(int, input().split())def can_pass(option): cnt = 0 for i in range(N): before = heights[i][0] if option == 'row' else heights[0][i] to_top = to_bottom = F..

CS/알고리즘 2026.07.12