본문 바로가기

전체 글

[백준/파이썬] 10026. 적록색약 [Gold V] 적록색약 - 10026문제 링크성능 요약메모리: 115180 KB, 시간: 136 ms분류그래프 이론, 그래프 탐색, 너비 우선 탐색, 깊이 우선 탐색, 격자 그래프제출 일자2025년 11월 24일 19:21:51문제 설명적록색약은 빨간색과 초록색의 차이를 거의 느끼지 못한다. 따라서, 적록색약인 사람이 보는 그림은 아닌 사람이 보는 그림과는 좀 다를 수 있다.크기가 N×N인 그리드의 각 칸에 R(빨강), G(초록), B(파랑) 중 하나를 색칠한 그림이 있다. 그림은 몇 개의 구역으로 나뉘어져 있는데, 구역은 같은 색으로 이루어져 있다. 또, 같은 색상이 상하좌우로 인접해 있는 경우에 두 글자는 같은 구역에 속한다. (색상의 차이를 거의 느끼지 못하는 경우도 같은 색상이라 한다)예를 들어.. 더보기
[Leetcode/파이썬] 33. Search in Rotated Sorted Array Search in Rotated Sorted ArrayThere is an integer array nums sorted in ascending order (with distinct values).Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 ) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become.. 더보기
[Leetcode/파이썬] 50. Pow(x, n) Pow(x, n)Implement pow(x, n), which calculates x raised to the power n (i.e., xn). Example 1:Input: x = 2.00000, n = 10Output: 1024.00000Example 2:Input: x = 2.10000, n = 3Output: 9.26100Example 3:Input: x = 2.00000, n = -2Output: 0.25000Explanation: 2-2 = 1/22 = 1/4 = 0.25 Constraints:-100.0 -231 31-1n is an integer.Either x is not zero or n > 0.-104 n 4 class Solution: def myPow(self, x: fl.. 더보기
[Leetcode/파이썬] 167. Two Sum II - Input Array Is Sorted Two Sum II - Input Array Is SortedGiven a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 1 2 .Return the indices of the two numbers, index1 and index2, added by one as an integer array [index1, index2] of length 2.The tests .. 더보기
[백준/파이썬] 19238. 스타트 택시 # [Gold II] 스타트 택시 - 19238 [문제 링크](https://www.acmicpc.net/problem/19238) ### 성능 요약 메모리: 112144 KB, 시간: 168 ms ### 분류 구현, 그래프 이론, 그래프 탐색, 시뮬레이션, 너비 우선 탐색, 격자 그래프 ### 제출 일자 2025년 11월 11일 16:40:03 ### 문제 설명스타트링크가 "스타트 택시"라는 이름의 택시 사업을 시작했다. 스타트 택시는 특이하게도 손님을 도착지로 데려다줄 때마다 연료가 충전되고, 연료가 바닥나면 그 날의 업무가 끝난다.택시 기사 최백준은 오늘 M명의 승객을 태우는 것이 목표이다. 백준이 활동할 영역은 N×N 크기의 격자로 나타낼 수 있고, 각 칸은 비어 있거나 벽이 놓여 있다. 택시가 .. 더보기
[Leetcode/파이썬] 117. Populating Next Right Pointers in Each Node II Populating Next Right Pointers in Each Node IIGiven a binary treestruct Node { int val; Node *left; Node *right; Node *next;}Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.Initially, all next pointers are set to NULL. Example 1:Input: root = [1,2,3,4,5,null,7]Output: [1,#,2,3,#,4,5,7,#]Explanation: Given the .. 더보기
[Leetcode/파이썬] 120. Triangle TriangleGiven a triangle array, return the minimum path sum from top to bottom.For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row. Example 1:Input: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]Output: 11Explanation: The triangle looks like: 2 3 4 6 5 74 1 8 3The m.. 더보기
[Leetcode/파이썬] 74. Search a 2D Matrix Search a 2D MatrixYou are given an m x n integer matrix matrix with the following two properties:Each row is sorted in non-decreasing order.The first integer of each row is greater than the last integer of the previous row.Given an integer target, return true if target is in matrix or false otherwise.You must write a solution in O(log(m * n)) time complexity. Example 1:Input: matrix = [[1,3,5,7].. 더보기