목록2025/02 (65)
넘치게 채우기
https://leetcode.com/problems/longest-strictly-increasing-or-strictly-decreasing-subarray/description/leetcode - Longest Strictly Increasing or Strictly Decreasing Subarray문제 유형: 슬라이딩 윈도우문제 난이도: Easy 문제You are given an array of integers nums. Return the length of the longest subarray of nums which is either strictly increasing or strictly decreasing. 정수 배열 nums가 주어진다. 가장 긴 오름차순 또는 내림차순 부분배열의 길이를..
https://www.acmicpc.net/problem/2098BOJ - 외판원 순회문제 유형: TSP(외판원 순회), 비트마스킹, 다이나믹 프로그래밍, dfs문제 난이도: Gold I시간 제한: 1초메모리 제한: 128MB 문제외판원 순회 문제는 영어로 Traveling Salesman problem (TSP) 라고 불리는 문제로 computer science 분야에서 가장 중요하게 취급되는 문제 중 하나이다. 여러 가지 변종 문제가 있으나, 여기서는 가장 일반적인 형태의 문제를 살펴보자.1번부터 N번까지 번호가 매겨져 있는 도시들이 있고, 도시들 사이에는 길이 있다. (길이 없을 수도 있다) 이제 한 외판원이 어느 한 도시에서 출발해 N개의 도시를 모두 거쳐 다시 원래의 도시로 돌아오는 순회 여행 ..
https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/description/leetcode - Check if Array Is Sorted and Rotated문제 유형: 배열, 구현문제 난이도: Easy 문제Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false.There may be duplicates in the original array.Note: An array A rotated ..
https://www.acmicpc.net/problem/2887BOJ - 행성 터널문제 유형: MST(최소 신장 트리), 최단 경로, 그래프, 정렬, 이진 탐색문제 난이도: Platinum V시간 제한: 1초메모리 제한: 128MB 문제때는 2040년, 이민혁은 우주에 자신만의 왕국을 만들었다. 왕국은 N개의 행성으로 이루어져 있다. 민혁이는 이 행성을 효율적으로 지배하기 위해서 행성을 연결하는 터널을 만들려고 한다.행성은 3차원 좌표위의 한 점으로 생각하면 된다. 두 행성 A(xA, yA, zA)와 B(xB, yB, zB)를 터널로 연결할 때 드는 비용은 min(|xA-xB|, |yA-yB|, |zA-zB|)이다.민혁이는 터널을 총 N-1개 건설해서 모든 행성이 서로 연결되게 하려고 한다. 이때, 모..
https://leetcode.com/problems/special-array-i/description/leetcode - Special Array I문제 유형: 구현문제 난이도: Easy 문제An array is considered special if every pair of its adjacent elements contains two numbers with different parity.You are given an array of integers nums. Return true if nums is a special array, otherwise, return false. 배열의 모든 인접한 쌍들의 홀짝이 다르면 특별한 배열이다. 특별한지 아닌지 확인하시오. 풀이i번과 i+1번의 홀짝여부가 한 번이..