목록구현 (48)
넘치게 채우기
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://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번의 홀짝여부가 한 번이..
https://codeforces.com/contest/2063/problem/DCodeforces Round 1000(Div. 2) - D. Game With Triangles문제 유형: 그리디, 수학, 기하학, 삼분 탐색, 구현, 투 포인터, 브루트 포스, 부분합, 구간합시간 제한: 2초메모리 제한: 256MB 문제There are n+m">n+m distinct points (a1,0),(a2,0),…,(an,0),(b1,2),(b2,2),…,(bm,2)">(a1,0),(a2,0),…,(an,0),(b1,2),(b2,2),…,(bm,2) on the plane. Initially, your score is 0">0. To increase your score, you can ..
https://www.acmicpc.net/problem/9328BOJ - 열쇠문제 유형: 구현, bfs, 그래프, 시뮬레이션문제 난이도: Gold I시간 제한: 1초메모리 제한: 256MB 문제상근이는 1층 빌딩에 침입해 매우 중요한 문서를 훔쳐오려고 한다. 상근이가 가지고 있는 평면도에는 문서의 위치가 모두 나타나 있다. 빌딩의 문은 모두 잠겨있기 때문에, 문을 열려면 열쇠가 필요하다. 상근이는 일부 열쇠를 이미 가지고 있고, 일부 열쇠는 빌딩의 바닥에 놓여져 있다. 상근이는 상하좌우로만 이동할 수 있다.상근이가 훔칠 수 있는 문서의 최대 개수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 테스트 케이스의 개수가 주어진다. 테스트 케이스의 수는 100개를 넘지 않는다.각 테스트 케이스의 첫째 줄에는 ..
https://leetcode.com/problems/first-completely-painted-row-or-column/description/leetcode - First Completely Painted Row or Column문제 유형: 행렬, 구현, 시뮬레이션문제 난이도: Medium 문제You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n].Go through each index i in arr starting from index 0 and paint the cell in mat containi..
https://codeforces.com/contest/2055/problem/DCodeforces Round 996(Div.2) - D. Scarecrow문제 유형: 그리디, 구현, 수학시간 제한: 2초메모리 제한: 256MB 문제A crow is sitting at position 0">0 of the number line. There are n">n scarecrows positioned at integer coordinates a1,a2,…,an">a1,a2,…,an along the number line. These scarecrows have been enchanted, allowing them to move left and right at a speed of 1">1unit pe..
https://codeforces.com/contest/2055/problem/ACodeforces Round 996(Div.2) - A. Two Frogs문제 유형: 구현, 수학, 그리디시간 제한: 1초메모리 제한: 256MB 문제There are n">n lilypads arranged in a row, numbered from 1">1 to n">n from left to right. Alice and Bob are frogs initially positioned on distinct lilypads, a">a and b">b, respectively. They take turns jumping, starting with Alice.During a frog's turn, it can jump eit..
https://leetcode.com/problems/find-the-prefix-common-array-of-two-arrays/description/leetcode - Find the Prefix Common Array of Two Arrays문제 유형: 구현, 카운팅, 구간합문제 난이도: Medium 문제You are given two 0-indexed integer permutations A and B of length n.A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present at or before the index i in both A and B.Re..
https://www.acmicpc.net/problem/12100BOJ - 2048(Easy)문제 유형: 구현, 시뮬레이션, 백트래킹, 브루트 포스문제 난이도: Gold I시간 제한: 1초메모리 제한: 512MB 문제2048 게임은 4×4 크기의 보드에서 혼자 즐기는 재미있는 게임이다. 이 링크를 누르면 게임을 해볼 수 있다.이 게임에서 한 번의 이동은 보드 위에 있는 전체 블록을 상하좌우 네 방향 중 하나로 이동시키는 것이다. 이때, 같은 값을 갖는 두 블록이 충돌하면 두 블록은 하나로 합쳐지게 된다. 한 번의 이동에서 이미 합쳐진 블록은 또 다른 블록과 다시 합쳐질 수 없다. (실제 게임에서는 이동을 한 번 할 때마다 블록이 추가되지만, 이 문제에서 블록이 추가되는 경우는 없다) 의 경우에서 위로 ..
https://www.acmicpc.net/problem/2342BOJ - Dance Dance Revolution문제 유형: 구현, 다이나믹 프로그래밍문제 난이도: Gold III시간 제한: 2초메모리 제한: 128MB 문제승환이는 요즘 "Dance Dance Revolution"이라는 게임에 빠져 살고 있다. 하지만 그의 춤 솜씨를 보면 알 수 있듯이, 그는 DDR을 잘 하지 못한다. 그럼에도 불구하고 그는 살을 뺄 수 있다는 일념으로 DDR을 즐긴다.DDR은 아래의 그림과 같은 모양의 발판이 있고, 주어진 스텝에 맞춰 나가는 게임이다. 발판은 하나의 중점을 기준으로 위, 아래, 왼쪽, 오른쪽으로 연결되어 있다. 편의상 중점을 0, 위를 1, 왼쪽을 2, 아래를 3, 오른쪽을 4라고 정하자.처음에 게..