All Posts

Leetcode 1190: Reverse Substrings Between Each Pair of Parentheses

Given a string containing lowercase English letters and balanced parentheses, reverse the substrings enclosed within each pair of parentheses, starting from the innermost ones. After processing, return the resulting string without any parentheses.

Leetcode 1202: Smallest String With Swaps

You are given a string s and an array of pairs of indices pairs where each pair pairs[i] = [a, b] represents two indices in the string. You can swap the characters at any of these index pairs any number of times. Your task is to return the lexicographically smallest string that can be obtained after performing the swaps.

Leetcode 1208: Get Equal Substrings Within Budget

You are given two strings s and t of the same length, and an integer maxCost. You want to change string s to string t. The cost of changing the ith character of s to the ith character of t is the absolute difference between their ASCII values. Your task is to find the maximum length of a substring of s that can be changed to match the corresponding substring of t, with the total cost not exceeding maxCost.

Leetcode 1209: Remove All Adjacent Duplicates in String II

You are given a string s and an integer k. A k duplicate removal consists of selecting k adjacent and equal letters from the string and removing them, causing the left and the right side of the deleted substring to concatenate together. Repeat this operation until no more such removals are possible. Return the final string after all removals are done.

Leetcode 1233: Remove Sub-Folders from the Filesystem

You are given a list of folder paths, where each path represents a folder in the file system. The task is to remove all sub-folders from the list, keeping only the main folders.

Leetcode 1234: Replace the Substring for Balanced String

You are given a string containing only four kinds of characters: ‘Q’, ‘W’, ‘E’, and ‘R’. The string is balanced if each character appears exactly n/4 times, where n is the length of the string. The task is to find the minimum length of a substring that can be replaced to make the string balanced.