목록문자열처리 (74)
넘치게 채우기
https://www.acmicpc.net/problem/28707BOJ - 배열 정렬문제 유형: 문자열 처리, 최단 경로, 다익스트라, 해시문제 난이도: Gold I시간 제한: 1초메모리 제한: 1024MB 문제길이가 N인 양의 정수로 이루어진 배열 A=[A1,A2,⋯,AN]이 주어집니다. 이 배열을 비내림차순, 즉, A1≤A2≤⋯≤AN이 되도록 정렬하기 위해서 다음과 같은 M가지 조작을 순서와 횟수에 상관 없이 원하는 만큼 할 수 있습니다. A의 li번째 수와 ri번째 수를 바꿉니다. 비용은 ci가 듭니다. (1≤i≤M) A를 비내림차순으로 정렬하기 위해 필요한 비용 총합의 최솟값을 출력하세요. 입력첫 줄에 배열 A의 길이 N이 주어집니다. (2≤N≤8)둘째 줄에 A의 각 원소 A1,⋯,AN이 공백으..
https://www.acmicpc.net/problem/1509BOJ - 팰린드롬 분할문제 유형: 팰린드롬, 문자열 처리, 다이나믹 프로그래밍문제 난이도: Gold I시간 제한: 2초메모리 제한: 128MB 문제세준이는 어떤 문자열을 팰린드롬으로 분할하려고 한다. 예를 들어, ABACABA를 팰린드롬으로 분할하면, {A, B, A, C, A, B, A}, {A, BACAB, A}, {ABA, C, ABA}, {ABACABA}등이 있다.분할의 개수의 최솟값을 출력하는 프로그램을 작성하시오. 입력첫째 줄에 문자열이 주어진다. 이 문자열은 알파벳 대문자로만 이루어져 있고, 최대 길이는 2,500이다. 출력첫째 줄에 팰린드롬 분할의 개수의 최솟값을 출력한다. 풀이isPalindrome[l][r] = [l, r..
https://leetcode.com/problems/minimum-length-of-string-after-operations/description/leetcode - Minimum Length of String After Operations문제 유형: 문자열 처리, 그리디문제 난이도: Medium 문제You are given a string s.You can perform the following process on s any number of times:Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one ch..
https://leetcode.com/problems/check-if-a-parentheses-string-can-be-valid/description/leetcode - Check if a Parentheses String Can Be Valid문제 유형: 문자열 처리, 2-pass문제 난이도: Medium 문제A parentheses string is a nonempty string consisting only of '(' and ')'. It is valid if any of the following conditions is true:It is ().It can be written as AB (A concatenated with B), where A and B are valid parentheses..
https://leetcode.com/problems/construct-k-palindrome-strings/description/leetcode - Construct K Palindrome Strings문제 유형: 문자열 처리, 팰린드롬문제 난이도: Medium 문제Given a string s and an integer k, return true if you can use all the characters in s to construct k palindrome strings or false otherwise. 문자열 s와 정수 k가 주어집니다. 만약 s의 글자들로 k개의 팰린드롬 문자열로 만들 수 있으면 true를 아니면 false를 반환하시오. 풀이꽤 트리키해 보일 수 있지만, 문제를 간단하게 만들..
https://leetcode.com/problems/word-subsets/description/leetcode - Word Substts문제 유형: 문자열 처리, 집합문제 난이도: Medium 문제You are given two string arrays words1 and words2.A string b is a subset of string a if every letter in b occurs in a including multiplicity.For example, "wrr" is a subset of "warrior" but is not a subset of "world".A string a from words1 is universal if for every string b in words2, b..
https://leetcode.com/problems/string-matching-in-an-array/description/leetcode - String Matching in an Array문제 유형: 문자열 처리문제 난이도: Easy 문제Given an array of string words, return all strings in words that is a substring of another word. You can return the answer in any order.A substring is a contiguous sequence of characters within a string 문자열 배열 words가 주어집니다. word의 다른 단어의 부분문자열인 문자열을 담아서 반환하시오.순서는..
https://leetcode.com/problems/shifting-letters-ii/description/leetcode - Shifting Letters II문제 유형: 문자열 처리, 슬라이딩 윈도우, 라인 스위핑, 구간합문제 난이도: Medium 문제You are given a string s of lowercase English letters and a 2D integer array shifts where shifts[i] = [starti, endi, directioni]. For every i, shift the characters in s from the index starti to the index endi (inclusive) forward if directioni = 1, or sh..
https://leetcode.com/problems/count-vowel-strings-in-ranges/description/leetcode - Count Vowel Strings in Ranges문제 유형: 문자열 처리, 부분합문제 난이도: Medium 문제You are given a 0-indexed array of strings words and a 2D array of integers queries.Each query queries[i] = [li, ri] asks us to find the number of strings present in the range li to ri (both inclusive) of words that start and end with a vowel.Return a..
https://leetcode.com/problems/number-of-ways-to-form-a-target-string-given-a-dictionary/description/leetcode - Number of Ways to Form a Target String Given a Dictionary문제 유형: 다이나믹 프로그래밍, 문자열 처리문제 난이도: Hard 문제You are given a list of strings of the same length words and a string target.Your task is to form target using the given words under the following rules:target should be formed from left to ..