목록PS/LeetCode (552)
넘치게 채우기
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/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/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/minimum-number-of-operations-to-move-all-balls-to-each-box/description/leetcode - Minimum Number of Operations to Move All Balls to Each Box문제 유형: 그리디, 구간합, 라인 스위핑문제 난이도: Medium 문제You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empty, and '1' if it contains one ball.In one operation, you can move one ball fr..
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/number-of-ways-to-split-array/description/leetcode - Number of Ways to Split Array문제 유형: 슬라이딩 윈도우, 구간합문제 난이도: Medium 문제You are given a 0-indexed integer array nums of length n.nums contains a valid split at index i if the following are true:The sum of the first i + 1 elements is greater than or equal to the sum of the last n - i - 1 elements.There is at least one el..
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/minimum-cost-for-tickets/description/leetcode - Minimum Cost For Tickets문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365.Train tickets are sold in three different ways:a 1-day pass is sold for costs[0] dol..