2949. Count Beautiful Substrings II
You are given a string
sand a positive integerk.Let
vowelsandconsonantsbe the number of vowels and consonants in a string.A string is beautiful if:
vowels == consonants.(vowels * consonants) % k == 0, in other terms the multiplication ofvowelsandconsonantsis divisible byk.Return the number of non-empty beautiful substrings in the given string
s.A substring is a contiguous sequence of characters in a string.
Vowel letters in English are
'a','e','i','o', and'u'.Consonant letters in English are every letter except vowels.
2948. Make Lexicographically Smallest Array by Swapping Elements
You are given a 0-indexed array of positive integers
numsand a positive integerlimit.In one operation, you can choose any two indices
iandjand swapnums[i]andnums[j]if|nums[i] - nums[j]| <= limit.Return the lexicographically smallest array that can be obtained by performing the operation any number of times.
An array
ais lexicographically smaller than an arraybif in the first position whereaandbdiffer, arrayahas an element that is less than the corresponding element inb. For example, the array[2,10,3]is lexicographically smaller than the array[10,2,3]because they differ at index0and2 < 10.
2947. Count Beautiful Substrings I
You are given a string
sand a positive integerk.Let
vowelsandconsonantsbe the number of vowels and consonants in a string.A string is beautiful if:
vowels == consonants.(vowels * consonants) % k == 0, in other terms the multiplication ofvowelsandconsonantsis divisible byk.Return the number of non-empty beautiful substrings in the given string
s.A substring is a contiguous sequence of characters in a string.
Vowel letters in English are
'a','e','i','o', and'u'.Consonant letters in English are every letter except vowels.