본문 바로가기

전체 글

[코드트리/파이썬] 해적 선장 코디 문제https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/pirate-captain-coddy/description 코딩테스트 기출 문제 설명: 해적 선장 코디 | 코드트리코딩테스트 기출 문제 해적 선장 코디의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai 코드https://github.com/jeongminllee/CodeTreeTest/blob/main/samsung-sw/%ED%95%B4%EC%A0%81%20%EC%84%A0%EC%9E%A5%20%EC%BD%94%EB%94%94/pirate-captain-coddy.py CodeTreeTest/samsung-sw/해적 선장 .. 더보기
[코드트리/파이썬] AI 로봇 청소기 - 3 https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/ai-robot/description 코딩테스트 기출 문제 설명: AI 로봇청소기 | 코드트리코딩테스트 기출 문제 AI 로봇청소기의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai # ===="""1. 청소기 이동- 로봇은 순서대로 움직인다 => input 된 순서대로- 이동 거리가 가장 가까운 오염된 격자로 이동.- 상하좌우로 인접한 격자를 한 칸씩 이동- 우선순위 : 이동거리, 행, 열2. 청소- 청소기가 바라보고 있는 방향을 기준으로 본인이 위치한 격자, 왼쪽, 위쪽, 오른쪽 격자 청소- 청소할 수 있는 4가지 격자에서 청.. 더보기
[코드트리/파이썬] AI 로봇청소기 - 2 https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/ai-robot/description 코딩테스트 기출 문제 설명: AI 로봇청소기 | 코드트리코딩테스트 기출 문제 AI 로봇청소기의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai from collections import dequeROBOT_DIRECTION = [[-1, 0], [0, -1], [0, 1], [1, 0]] # 상좌우하def robots_move(robots : deque[list[int]], idx: int) : """ robots : 로봇 청소기들 좌표 idx : 현재 로봇 청소기 번호.. 더보기
[코드트리/파이썬] AI 로봇청소기 - 1 # ====from collections import dequeROBOT_DIRECTION = [[-1, 0], [0, -1], [0, 1], [1, 0]] # 상좌우하def robots_move(robots : deque[list[int]], idx: int) : """ 1. 청소기 이동 이동 거리가 가장 가까운 오염된 격자로 이동. => 가장 가까운 이동거리를 구해야함. BFS 물건이나 청소기가 있는 격자로는 이동불가. 상하좌우로 인접한 격자를 한 칸씩 이동하여 도달하는 데 필요한 최소 이동 횟수를 의미 우선순위 : 가장 가까운 먼지 > 행번호 > 열번호 """ robot_q = deque() visited = [[0] * N for _ in ra.. 더보기
[코드트리/파이썬] 가로등 설치 - 2 Codetree | Learning to Code with Confidence 코딩테스트 기출 문제 설명: 가로등 설치 | 코드트리코딩테스트 기출 문제 가로등 설치의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai double linked list, heap의 Lazy Deletion을 활용해서 빠른 시간에 가로등 ID와 위치를 찾아내고 제거 처리를 할 수 있을 것이냐.추가로, 바로바로 삭제 처리를 하면 시간 복잡도가 초과할 수 있기 때문에 지연 처리, Lazy Deletion을 할 수 있느냐 를 물어보는 문제.코딩테스트 연습 - 이중우선순위큐 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한.. 더보기
[코드트리/파이썬] 가로등 설치 https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/street-light-installation/description 코딩테스트 기출 문제 설명: 가로등 설치 | 코드트리코딩테스트 기출 문제 가로등 설치의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.www.codetree.ai import heapqdef init(query : list[int]) : """ cmd = 100 일때 초기 세팅 """ cmd, N, M, *town = query town = [-1] + town # [-1, n1, n2, n3, ...] idx : 가로등 번호, n_ : 가로등 위치 .. 더보기
[Leetcode/파이썬] 104. Maximum Depth of Binary Tree Maximum Depth of Binary TreeGiven the root of a binary tree, return its maximum depth.A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1:Input: root = [3,9,20,null,null,15,7]Output: 3Example 2:Input: root = [1,null,2]Output: 2 Constraints:The number of nodes in the tree is in the range [0, 104].-100 # Definiti.. 더보기
[Leetcode/파이썬] 11. Container With Most Water Container With Most WaterYou are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).Find two lines that together with the x-axis form a container, such that the container contains the most water.Return the maximum amount of water a container can store.Notice that you may not slant the container. Ex.. 더보기