Two strings, s and t, each of length n, that contain lowercase English characters are given as well as an integer K.
Find the maximum length of a substring of s that can be changed to the corresponding substring of t with a total cost less than or equal to K. If there is no such substring, return 0.
Example:
s = "adpgki", t = "cdmxki", K = 6.
The longest substring in s that is equal to the corresponding substring in t is s[0, 2] = t[0, 2]. Hence, the answer is 3.
Constraints:
A professional society is organizing a conference and needs to form a diverse deputation of 3 members.
The deputation must meet the following criteria:
You are given:
Your task is to calculate the total number of distinct ways to select a diverse deputation of 3 members, following the diversity rule.
Example:
m = 1
w = 3
There is m = 1 man available and there are w = 3 women. Label them m1, w1, w2, w3 for demonstration. There are 3 possible ways to form a diverse deputation: (m1, w1, w2), (m1, w1, w3) and (m1, w2, w3). The only other possible permutation is (w1, w2, w3), which does not include a man, so it is invalid.