목록2024/11 (59)
넘치게 채우기
https://leetcode.com/problems/minimum-number-of-changes-to-make-binary-string-beautiful/description/?envType=daily-question&envId=2024-11-05leetcode - Minimum Number of Changes to Make Binary String Beautiful문제 유형: 문자열 처리, 그리디문제 난이도: Medium 문제You are given a 0-indexed binary string s having an even length.A string is beautiful if it's possible to partition it into one or more substrings such tha..
https://www.acmicpc.net/problem/12865BOJ - 평범한 배낭문제 유형: 다이나믹 프로그래밍, 배낭 문제문제 난이도: Gold V시간 제한: 2초메모리 제한: 512MB 문제이 문제는 아주 평범한 배낭에 관한 문제이다.한 달 후면 국가의 부름을 받게 되는 준서는 여행을 가려고 한다. 세상과의 단절을 슬퍼하며 최대한 즐기기 위한 여행이기 때문에, 가지고 다닐 배낭 또한 최대한 가치 있게 싸려고 한다.준서가 여행에 필요하다고 생각하는 N개의 물건이 있다. 각 물건은 무게 W와 가치 V를 가지는데, 해당 물건을 배낭에 넣어서 가면 준서가 V만큼 즐길 수 있다. 아직 행군을 해본 적이 없는 준서는 최대 K만큼의 무게만을 넣을 수 있는 배낭만 들고 다닐 수 있다. 준서가 최대한 즐거운 ..
https://leetcode.com/problems/string-compression-iii/description/?envType=daily-question&envId=2024-11-04leetcode - String Compression III문제 유형: 문자열 처리, 투 포인터문제 난이도: Medium 문제Given a string word, compress it using the following algorithm:Begin with an empty string comp. While word is not empty, use the following operation:Remove a maximum length prefix of word made of a single character c repeat..
https://www.acmicpc.net/problem/9251BOJ - LCS문제 유형: 문자열 처리, 재귀, 다이나믹 프로그래밍문제 난이도: Gold V시간 제한: 0.1초메모리 제한: 256MB 문제LCS(Longest Common Subsequence, 최장 공통 부분 수열)문제는 두 수열이 주어졌을 때, 모두의 부분 수열이 되는 수열 중 가장 긴 것을 찾는 문제이다.예를 들어, ACAYKP와 CAPCAK의 LCS는 ACAK가 된다. 입력첫째 줄과 둘째 줄에 두 문자열이 주어진다. 문자열은 알파벳 대문자로만 이루어져 있으며, 최대 1000글자로 이루어져 있다. 출력첫째 줄에 입력으로 주어진 두 문자열의 LCS의 길이를 출력한다. 풀이dp[i1][i2]는 첫 번째 문자열의 i1인덱스부터의 부분문자..
https://leetcode.com/problems/rotate-string/description/?envType=daily-question&envId=2024-11-03leetcode - Rotate String문제 유형: 문자열 처리, 완전 탐색문제 난이도: Easy 문제Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.A shift on s consists of moving the leftmost character of s to the rightmost position.For example, if s = "abcde", then it will be "bcd..
https://www.acmicpc.net/problem/2096BOJ - 내려가기문제 유형: 다이나믹 프로그래밍문제 난이도: Gold V시간 제한: 1초메모리 제한: 4MB 문제N줄에 0 이상 9 이하의 숫자가 세 개씩 적혀 있다. 내려가기 게임을 하고 있는데, 이 게임은 첫 줄에서 시작해서 마지막 줄에서 끝나게 되는 놀이이다.먼저 처음에 적혀 있는 세 개의 숫자 중에서 하나를 골라서 시작하게 된다. 그리고 다음 줄로 내려가는데, 다음 줄로 내려갈 때에는 다음과 같은 제약 조건이 있다. 바로 아래의 수로 넘어가거나, 아니면 바로 아래의 수와 붙어 있는 수로만 이동할 수 있다는 것이다. 이 제약 조건을 그림으로 나타내어 보면 다음과 같다.별표는 현재 위치이고, 그 아랫 줄의 파란 동그라미는 원룡이가 다음..
https://leetcode.com/problems/circular-sentence/description/?envType=daily-question&envId=2024-11-02leetcode - Circular Sentence문제 유형: 문자열 처리, 배열문제 난이도: Easy 문제A sentence is a list of words that are separated by a single space with no leading or trailing spaces.For example, "Hello World", "HELLO", "hello world hello world" are all sentences.Words consist of only uppercase and lowercase English l..
https://www.acmicpc.net/problem/17070BOJ - 파이프 옮기기 1문제 유형: dfs/bfs, 다이나믹 프로그래밍문제 난이도: Gold V시간 제한메모리 제한 문제유현이가 새 집으로 이사했다. 새 집의 크기는 N×N의 격자판으로 나타낼 수 있고, 1×1크기의 정사각형 칸으로 나누어져 있다. 각각의 칸은 (r, c)로 나타낼 수 있다. 여기서 r은 행의 번호, c는 열의 번호이고, 행과 열의 번호는 1부터 시작한다. 각각의 칸은 빈 칸이거나 벽이다.오늘은 집 수리를 위해서 파이프 하나를 옮기려고 한다. 파이프는 아래와 같은 형태이고, 2개의 연속된 칸을 차지하는 크기이다.파이프는 회전시킬 수 있으며, 아래와 같이 3가지 방향이 가능하다.파이프는 매우 무겁기 때문에, 유현이는 파이..
https://leetcode.com/problems/delete-characters-to-make-fancy-string/description/?envType=daily-question&envId=2024-11-01leetcode - Delete Characters to Make Fancy String문제 유형: 문자열 처리문제 난이도: Easy 문제A fancy string is a string where no three consecutive characters are equal.Given a string s, delete the minimum possible number of characters from s to make it fancy.Return the final string after the ..