snowflake 的intern OA 今年开启，难度爆炸，3道至少hard级别的，且只能使用java和C++，不能使用python，由于时间的问题，写完十分的困难。下面是真题节选

**1. String Patterns**

Given the length of a word (`wordLen`

) and the maximum number of consecutive vowels that it can contain (`maxVowels`

), determine how many unique words can be generated. Words will consist of English alphabetic letters a through z only. Vowels are {a, e, i, o, u}; consonants are the remaining 21 letters. In the explanations, v and c represent vowels and consonants.

`wordLen = 1`

`maxVowels = 1`

Patterns: {v, c} That means there are 26 possibilities, one for each letter in the alphabet.

`wordLen = 4`

`maxVowels = 1`

Patterns: {cccc, vccc, cvcc, ccvc, ccvv, vcvv, cvcv, vvcc} There are 412,776 possible solutions – see below:

(21×21×21×21)=194481(21×21×21×21)=194481 (5×21×21×21)+(21×5×21×21)+(21×21×5×21)+(21×21×21×5)=4×46305=185220(5×21×21×21)+(21×5×21×21)+(21×21×5×21)+(21×21×21×5)=4×46305=185220 (5×21×5×21)+(21×5×5×21)+(5×21×21×5)=3×11025=33075(5×21×5×21)+(21×5×5×21)+(5×21×21×5)=3×11025=33075 194481+185220+33075=412776.194481+185220+33075=412776 *p**oss**ib**l**e so**l**u**t**i**o**n**s*.

`wordLen = 4`

`maxVowels = 2`

In this case, all of the combinations from the previous example are still valid.

- There are 5 additional patterns to consider, three with 2 vowels (wvc, cvw, ccw) and 2 with 3 vowels (wcv and vcw).
- Their counts are 3×(5×5×21)+(5×5×21×5)=330753×(5×5×21)+(5×5×21×5)=33075 and 2×(5×5×5×21)=2×2625=5250.2×(5×5×5×21)=2×2625=5250.
- The total number of combinations then is 412776+33075+5250=451101.412776+33075+5250=451101.

The result may be a very large number, so return the answer modulo 109+7109+7.

**Note:** While the answers will be within the limit of a 32 bit integer, interim values may exceed that limit. Within the function, you may need to use a 64 bit integer type to store them.

**Function Description**

Complete the function `calculateWays`

in the editor below.

`calculateWays`

has the following parameter(s):

`int wordLen`

: the length of a word`int maxVowels`

: the maximum number of consecutive vowels allowed in a word

**Returns**

`int`

: the number of well-formed strings that can be created, modulo 109+7109+7

**Constraints**

- 1≤25001≤
*w**or**d**L**e**n*≤2500 - 0≤
*ma**x**V**o**w**e**l**s*≤*n*

**Sample Case 1**

**Sample Input 1**

STDIN Function

2 wordLen = 2 1 maxVowels = 1

**Sample Output 1**

676

**Explanation 1**

Since the words are 2 characters, and there can be 2 consecutive vowels, each position can contain any character. Words take the forms {vv, vc, cv, cc}. The total number of unique words is (26×26)=676(26×26)=676 and 676 modulo 1000000007=676.676 modulo 1000000007=676.

**Sample Case 2**

**Sample Input 2**

STDIN Function

**2. Maximum Substrings**

The people in HackerLand, are getting ready for a parade. There should be no instance where a person is wearing a white-colored uniform. There is a given string `color`

that contains lowercase English characters ('a' - 'z'). Some of the positions in the string are empty, meaning that the color of the uniform is white at that position and is denoted by the '.' character.

A *beautiful* string is defined as a string in which all characters are the same. For example "aaa", "zzzzz", "f" are beautiful while "aba", "aaad" are not beautiful. Replace each non-colored uniform with some lowercase English character such that the total number of substrings that are beautiful maximized.

Find the maximum total number of beautiful substrings after replacing every empty character.

**Note:** A substring of a string is a contiguous subsequence of that string.

**3. Unequal Elements**

A test needs to be prepared on the HackerRank platform with questions from different sets of skills to assess candidates. Given an array, `skills`

, of size `n`

, where `skills[j]`

denotes the skill type of the *j^**t**h* question, select skills for the questions on the test. The skills should be grouped together as much as possible. The goal is to find the maximum length of a subsequence of `skills`

such that there...

联系我来获取完整的题目信息和解题思路，我们可以协助您解决任何OA VO