All Posts
Leetcode 3081: Replace Question Marks in String to Minimize Its Value
You are given a string s consisting of lowercase English letters and question marks (?). Your task is to replace all occurrences of ? with any lowercase English letter in such a way that the total cost of the resulting string is minimized. The cost of a string is the sum of how many times each character has appeared before its current position. If there are multiple solutions with the same minimal cost, return the lexicographically smallest one.
Leetcode 3110: Score of a String
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 the string s.
Leetcode 3120: Count the Number of Special Characters I
You are given a string word. A letter is considered special if it appears both in its lowercase and uppercase form in the string. Return the number of special letters in word.
Leetcode 3121: Count the Number of Special Characters II
You are given a string word. A letter c is called special if it appears both in lowercase and uppercase in word, and every lowercase occurrence of c appears before the first uppercase occurrence of c. Return the number of special letters in word.
Leetcode 3136: Valid Word
You are given a string word. The word is considered valid if it satisfies the following conditions:
- It contains at least 3 characters.
- It contains only digits (0-9) and English letters (both uppercase and lowercase).
- It must include at least one vowel (‘a’, ’e’, ‘i’, ‘o’, ‘u’ and their uppercase counterparts).
- It must include at least one consonant (an English letter that is not a vowel).
Return true if the word is valid, otherwise return false.