목록문자열처리 (25)
넘치게 채우기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bEjGsd/btsHRYZxxiR/KGKj0xlD0Ako8HDKdiKqd1/img.png)
https://leetcode.com/problems/replace-words/description/leetcode - Replace Words문제 유형 : 문자열 처리, 트라이(Trie)문제 난이도 : Medium 문제In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".Given a dictionary consisti..
https://leetcode.com/problems/find-common-characters/description/ leetcode - Find Common Characters문제 유형 : 문자열 처리, 구현문제 난이도 : Easy 문제Given a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order. 문자열 배열 words가 주어진다. words의 모든 문자들에서 겹치는 문자들을 찾아 반환하시오. 어떤 순서든 상관없습니다. 풀이freq(26,1e9) 배열을 만들어서 ..
https://leetcode.com/problems/longest-palindrome/description/?source=submission-noacleetcode - Longest Palindrome문제 유형 : 문자열 처리문제 난이도 : Easy 문제Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.Letters are case sensitive, for example, "Aa" is not considered a palindrome. 문자열 s가 주어집니다. 이들로 만들 수 있는 가장 ..
https://leetcode.com/problems/append-characters-to-string-to-make-subsequence/description/leetcode - Append Characters to String to Make Subsequence문제 유형 : 문자열처리, 그리디문제 난이도 : Medium문제 You are given two strings s and t consisting of only lowercase English letters.Return the minimum number of characters that need to be appended to the end of s so that t becomes a subsequence of s.A subsequence is ..
https://leetcode.com/problems/reverse-string/description/leetcode - Reverse String문제 유형 : 문자열 처리, 투 포인터문제 난이도 : Easy 문제Write a function that reverses a string. The input string is given as an array of characters s.You must do this by modifying the input array in-place with O(1) extra memory. 역문자열로 만드는 함수를 작성하시오. 배열로 주어집니다.O(1)공간복잡도여야 합니다. 풀이left가 right보다 작은동안, swap()해주면 된다.left++right-- 코드C++cla..
https://leetcode.com/problems/score-of-a-string/description/leetcode - Score of a String문제 유형 : 문자열 처리, 투 포인터문제 난이도 : Easy 문제You are given a string s. The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters.Return the score of s. 문자열 s를 받는다.문자열의 점수는 두 인접한 문자들의 아스키 값의 차들의 합으로 한다.s의 점수를 구하시오. 풀이0, 11, 2...n-2, n-1의 아스키 값의 차들을 구해서 누적시킨다..
https://leetcode.com/problems/get-equal-substrings-within-budget/description/leetcode - Get Equal Substrings Within Budget문제 유형 : 문자열 처리, 슬라이딩 윈도우문제 난이도 : Medium 문제You are given two strings s and t of the same length and an integer maxCost.You want to change s to t. Changing the ith character of s to ith character of t costs |s[i] - t[i]| (i.e., the absolute difference between the ASCII values o..
https://leetcode.com/problems/word-break-ii/description/leetcode - Word Break II문제 유형 : 문자열 처리, 다이나믹 프로그래밍문제 난이도 : Hard 문제Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.Note that the same word in the dictionary may be reused multiple times in the segmentatio..
https://leetcode.com/problems/compare-version-numbers/description/leetcode - Compare Version Numbers문제 유형 : 문자열 처리, 투 포인터, 슬라이딩 윈도우문제 난이도 : Medium 문제Given two version numbers, version1 and version2, compare them.Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revi..
https://leetcode.com/problems/reverse-prefix-of-word/description/leetcode - Reverse Prefix of Word문제 유형 : 문자열 처리, 스택, 큐문제 난이도 : Easy 문제Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist in word, do nothing.For example, if word = "abcdefd" and ch = ..