All Posts

Leetcode 3138: Minimum Length of Anagram Concatenation

You are given a string s, which is a concatenation of several anagrams of some string t. Your task is to find the minimum possible length of the string t. An anagram is formed by rearranging the letters of a string. For example, ‘abc’ and ‘cab’ are anagrams of each other. The string t is the original string that has been rearranged multiple times to form s.

Leetcode 3146: Permutation Difference between Two Strings

You are given two strings, s and t, where every character occurs at most once in both strings and t is a permutation of s. The permutation difference between s and t is defined as the sum of the absolute differences between the index of each character in s and the index of the occurrence of the same character in t. Your task is to compute the permutation difference between s and t.

Leetcode 3163: String Compression III

You are given a string word. Compress the string using the following algorithm:

Begin with an empty string comp. While word is not empty, perform the following operation:

  1. Remove the longest prefix from word that consists of the same character repeating up to 9 times.
  2. Append the length of this prefix followed by the character to comp. Return the resulting string comp.

Leetcode 3168: Minimum Number of Chairs in a Waiting Room

You are given a string s representing a sequence of events where each character is either ‘E’ (a person enters the waiting room) or ‘L’ (a person leaves the waiting room). The waiting room starts empty. Simulate the events and determine the minimum number of chairs required to ensure there is always a chair available for every person who enters the room.