목록문자열 처리 (13)
넘치게 채우기
https://www.acmicpc.net/problem/1360BOJ - 되돌리기문제 유형: 구현, 문자열 처리문제 난이도: Gold V시간 제한: 2초메모리 제한: 128MB 문제민식이는 다음과 같이 두 개의 명령만 지원하는 새로운 텍스트 에디터를 만들었다.“type c" : 현재 글의 가장 뒤에 문자 c를 추가한다.“undo t" : 이전 t초동안 수행된 작업을 역순으로 되돌린다.처음 텍스트 에디터는 비어있다.예를 들어, 다음과 같은 명령을 진행했다고 하자.1초 : type a2초 : type b3초 : type c5초 : undo 33초가 끝날 때, 텍스트는 "abc"이다. 5초때, 이전 3초동안 한 작업을 역순으로 되돌려야 한다. c는 지워지고, b도 지워질 것이다. 따라서 a만 남는다.되돌리기..
https://www.acmicpc.net/problem/19832BOJ - 19832 - Configuration file문제 유형: 문자열 처리, 파싱, 스택, 해시문제 난이도: Gold IV시간 제한: 2초메모리 제한: 512MB 문제Vadim develops a parser for configuration files of his project. A configuration file consists of blocks delimited with braces: "{" marks the beginning of the block, and "}" marks the end of the block. Blocks can be nested. One block can contains several other bloc..
https://www.acmicpc.net/problem/5052BOJ - Phone List문제 유형: 문자열 처리, 트라이, 정렬문제 난이도: Gold IV 문제전화번호 목록이 주어진다. 이때, 이 목록이 일관성이 있는지 없는지를 구하는 프로그램을 작성하시오.전화번호 목록이 일관성을 유지하려면, 한 번호가 다른 번호의 접두어인 경우가 없어야 한다.예를 들어, 전화번호 목록이 아래와 같은 경우를 생각해보자긴급전화: 911상근: 97 625 999선영: 91 12 54 26이 경우에 선영이에게 전화를 걸 수 있는 방법이 없다. 전화기를 들고 선영이 번호의 처음 세 자리를 누르는 순간 바로 긴급전화가 걸리기 때문이다. 따라서, 이 목록은 일관성이 없는 목록이다. 입력첫째 줄에 테스트 케이스의 개수 t가 주..
https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/description/leetcode - Recover a Tree From Preorder Traversal문제 유형: 스택, 트리, dfs, 문자열 처리문제 난이도: Hard 문제We run a preorder depth-first search (DFS) on the root of a binary tree.At each node in this traversal, we output D dashes (where D is the depth of this node), then we output the value of this node. If the depth of a node is D..
https://codeforces.com/contest/2064/problem/ACodeforces Round 1005(Div. 2) - A. Brogramming Contest문제 유형: 그리디, 문자열 처리시간 제한: 1초메모리 제한: 256MB 문제One day after waking up, your friend challenged you to a brogramming contest. In a brogramming contest, you are given a binary string∗">∗ s">s of length n">n and an initially empty binary string t">t.During a brogramming contest, you can make either..
https://leetcode.com/problems/remove-all-occurrences-of-a-substring/description/leetcode - Remove All Occurrences of a Substring문제 유형: 스택, 문자열 처리문제 난이도: Medium 문제Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed:Find the leftmost occurrence of the substring part and remove it from s.Return s after removing all occurrences o..
https://leetcode.com/problems/clear-digits/description/leetcode - Clear Digits문제 유형: 스택, 문자열 처리문제 난이도: Easy 문제You are given a string s.Your task is to remove all digits by doing this operation repeatedly:Delete the first digit and the closest non-digit character to its left.Return the resulting string after removing all digits. 문자열 s를 받습니다.당신의 임무는 다음을 반복적으로 수행하는 것 입니다:첫 번째 숫자를 지우고 왼쪽의 숫자가 아닌 문자를..
https://leetcode.com/problems/counting-words-with-a-given-prefix/description/leetcode - Counting Words With a Given Prefix문제 유형: 문자열 처리문제 난이도: Easy 문제You are given an array of strings words and a string pref.Return the number of strings in words that contain pref as a prefix.A prefix of a string s is any leading contiguous substring of s. 문자열 배열 words와 문자열 pref를 받는다.pref를 prefix로 가지는 문자열의 개수를 구하..
https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/description/leetcode - Count Prefix and Suffix Pairs I문제 유형: 문자열 처리문제 난이도: Easy 문제You are given a 0-indexed string array words.Let's define a boolean function isPrefixAndSuffix that takes two strings, str1 and str2:isPrefixAndSuffix(str1, str2) returns true if str1 is both a prefix and a suffix of str2, and false otherwise.For example..
https://leetcode.com/problems/construct-string-with-repeat-limit/description/leetcode - Construct String With Repeat Limit문제 유형: 우선순위 큐, 그리디, 문자열 처리문제 난이도: Medium 문제You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s...