[LeetCode] 1910. Remove All Occurrences of a Substring (Python)
·
알고리즘/LeetCode
난이도: 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 of part.A substring is a contiguous sequence of characters in a string. 문제 예제Example 1:Input: s = "daabcbaabcbc", part = "abc"Output: "dab"Explana..
[LeetCode] 3174. Clear Digits (Python)
·
알고리즘/LeetCode
난이도: 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. 문제 예제Example 1:Input: s = "abc"Output: "abc"Explanation:There is no digit in the string.Example 2:Input: s = "cb34"Output: ""Explanation:First, we apply the opera..