목록PS/LeetCode (587)
넘치게 채우기
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/single-number-iii/description/leetcode - Single Number III문제 유형 : 비트마스킹문제 난이도 : Medium 문제Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.You must write an algorithm that runs in linear runtime complexity and..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bhCZEO/btsHIeBDf1U/7z60gCqEISQSZDQu15aby0/img.png)
https://leetcode.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor/description/leetcode - Count Triplets That Can Form Two Arrays of Equal XOR문제 유형 : 부분합, 비트마스킹문제 난이도 : Medium 문제Given an array of integers arr.We want to select three indices i, j and k where (0 Let's define a and b as follows:a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]Note that..
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one/description/leetcode - Number of Steps to Reduce a Number in Binary Representation to One문제 유형 : 비트마스킹, 그리디문제 난이도 : Medium 문제Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules:If the current number is even, you have to d..
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/special-array-with-x-elements-greater-than-or-equal-x/description/leetcode - Special Array With X Elements Greater Than or Equal X문제 유형 : 이진 탐색문제 난이도 : Easy 문제You are given an array nums of non-negative integers. nums is considered special if there exists a number x such that there are exactly x numbers in nums that are greater than or equal to x.Notice that x does ..
https://leetcode.com/problems/student-attendance-record-ii/description/?envType=daily-question&envId=2024-05-26leetcode - Student Attendance Record II문제 유형 : 다이나믹 프로그래밍문제 난이도 : Hard 문제An attendance record for a student can be represented as a string where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters..
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..