[Leetcode] 2390 Removing Starts From a String (Python)
leetcode2025. 9. 24. 13:11[Leetcode] 2390 Removing Starts From a String (Python)

문제Removing Stars From a String - LeetCode설명You are given a string s, which contains stars *.In one operation, you can:Choose a star in s.Remove the closest non-star character to its left, as well as remove the star itself.Return the string after all stars have been removed.Note:The input will be generated such that the operation is always possible.It can be shown that the resulting string will a..

[Leetcode] 151 Reverse Words in a String (Python)
leetcode2025. 9. 23. 22:37[Leetcode] 151 Reverse Words in a String (Python)

문제Reverse Words in a String - LeetCode설명Given an input string s, reverse the order of the words.A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.Return a string of the words in reverse order concatenated by a single space.Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string shou..

[Leetcode] 1456 Maximum Number of Vowels in a Substring of Given Length (Python)
leetcode2025. 9. 17. 14:42[Leetcode] 1456 Maximum Number of Vowels in a Substring of Given Length (Python)

문제Maximum Number of Vowels in a Substring of Given Length - LeetCode설명Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k.Vowel letters in English are 'a', 'e', 'i', 'o', and 'u'.풀이 계획가장 많은 모음이 포함된 k의 길이만큼의 문자열에서의 모음의 갯수를 구하는 문제이다.초기 풀이 (8384ms, 18.22MB)class Solution: def maxVowels(self, s: str, k: int) -> int: vowels="aeio..

[BOJ] 백준_2810번_컵홀더_C/C++
백준 알고리즘2022. 2. 26. 11:56[BOJ] 백준_2810번_컵홀더_C/C++

문제 출처 https://www.acmicpc.net/problem/2810 2810번: 컵홀더 첫째 줄에 좌석의 수 N이 주어진다. (1 ≤ N ≤ 50) 둘째 줄에는 좌석의 정보가 주어진다. www.acmicpc.net 문제 설명 코드 //[BOJ] 2810번 컵홀더 #include using namespace std; int main() { int n; string s; cin >> n; int total = n+1; cin >> s; for (int i = 0; i n) total = n; cout

[BOJ] 백준_23303번_이 문제는 D2입니다._C/C++
백준 알고리즘2021. 11. 9. 09:41[BOJ] 백준_23303번_이 문제는 D2입니다._C/C++

문제 출처 https://www.acmicpc.net/problem/23303 23303번: 이 문제는 D2 입니다. 문자열 안에 $D2$나 $d2$가 들어있다면 D2를 출력한다. 두 글자는 반드시 붙어있어야 하며, $D$/$d$와 $2$ 사이에 공백이 있어도 안 된다. 만약 문자열 안에 해당 문자가 없다면 unrated를 출력한다. www.acmicpc.net 문제 올해도 연세대학교 프로그래밍 경진대회가 열렸다! 병철이는 원래 대회에 출전하여 상금을 타갈 생각을 하고 있었으나, 갑자기 출제진으로 끌려가게 되어버렸다. 출제진으로 끌려온 병철이에게 연세대학교 프로그래밍 경진대회는 지원을 받지 못하면 출제진이 사비로 상금을 지급해야 한다는 충격적인 소식이 들려왔지만, 다행히 지원을 받았기에 그런 대참사는 막..

[BOJ] 백준_10820번_문자열 분석 / C++
백준 알고리즘2021. 9. 6. 09:57[BOJ] 백준_10820번_문자열 분석 / C++

문제 출처 https://www.acmicpc.net/problem/10820 10820번: 문자열 분석 문자열 N개가 주어진다. 이때, 문자열에 포함되어 있는 소문자, 대문자, 숫자, 공백의 개수를 구하는 프로그램을 작성하시오. 각 문자열은 알파벳 소문자, 대문자, 숫자, 공백으로만 이루어져 있 www.acmicpc.net 코드 //[BOJ] 10820번_문자열 분석 #include #include #define SIZE 100 using namespace std; int main() { while (1) { int i = 0; int upper = 0, lower = 0, num = 0, blank = 0; char str[SIZE + 1]; cin.getline(str, SIZE+1); if (st..

728x90
반응형
image