All Posts
Leetcode 1684: Count the Number of Consistent Strings
You are given a string allowed consisting of distinct characters, and an array of strings words. A string is consistent if all characters in the string appear in the string allowed. Return the number of consistent strings in the array words.
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 1726: Tuple with Same Product
You are given an array of distinct positive integers nums. Your task is to count how many tuples (a, b, c, d) exist such that the product of a * b equals the product of c * d, where a, b, c, d are distinct elements of nums and a != b != c != d.
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
ais strictly less than every character in stringbalphabetically. - Every character in string
bis strictly less than every character in stringaalphabetically. - Both
aandbconsist of only one distinct character.
Return the minimum number of operations needed to achieve one of these conditions.