All Posts
Leetcode 1704: Determine if String Halves Are Alike
You are given a string ’s’ of even length. Split the string into two equal halves, where the first half is ‘a’ and the second half is ‘b’.
Two strings are considered alike if they contain the same number of vowels (a, e, i, o, u, A, E, I, O, U). Return ’true’ if ‘a’ and ‘b’ are alike, otherwise return ‘false’.
Leetcode 1717: Maximum Score From Removing Substrings
You are given a string s
and two integers x
and y
. You can perform two types of operations any number of times:
- Remove the substring “ab” and gain
x
points. - Remove the substring “ba” and gain
y
points.
Each time a substring is removed, the characters are deleted from the string, and the corresponding points are added to your total score. Your task is to maximize the total score after applying these operations any number of times.
Leetcode 1736: Latest Time by Replacing Hidden Digits
hh:mm
, where some digits may be missing and represented by a question mark (?
). Your task is to replace the ?
with digits to form the latest valid time in the 24-hour format, which is between 00:00
and 23:59
.
You are given a time string in the format Leetcode 1737: Change Minimum Characters to Satisfy One of Three Conditions
You are given two strings, a
and b
, consisting of lowercase letters. In one operation, you can change any character in either string to any lowercase letter. Your goal is to perform the minimum number of operations to satisfy one of the following three conditions:
- Every character in string
a
is strictly less than every character in stringb
alphabetically. - Every character in string
b
is strictly less than every character in stringa
alphabetically. - Both
a
andb
consist of only one distinct character.
Return the minimum number of operations needed to achieve one of these conditions.
Leetcode 1750: Minimum Length of String After Deleting Similar Ends
You are given a string s
consisting of only the characters ‘a’, ‘b’, and ‘c’. Your task is to repeatedly perform the following operation any number of times:
- Pick a non-empty prefix from the string where all characters are equal.
- Pick a non-empty suffix from the string where all characters are equal.
- The prefix and suffix should not intersect, and the characters in both should be the same.
- Remove the prefix and suffix.
Your goal is to find the minimum length of the string after performing the operation any number of times.