第一题,我们曾经发过,请点击查看
2. Vowel Substring
Given a string of lowercase letters in the range ascii['a'-'z']
, determine the number of substrings that can be created where every letter is a vowel and every vowel is present at least once. The vowels are {a, e, i, o, u}
. A substring is a contiguous group of characters in the string.
Example:s = 'aeioaexaaeiou'
There is a substring to the left that is made of vowels, 'aeioae'
, which is followed by an 'x'
. Since 'x'
is not a vowel, it cannot be included in the substring, and this substring does not contain all of the vowels. It is not a qualifying substring.
Moving to the right, there are four substrings that do qualify: 'aaeiou'
, 'aaeiou'
, 'aeiou'
, and 'aeuio'
.
Function Description:
Complete the function vowelSubstring
in the editor below.
Returnsint
: the number of substrings that consist of vowels only where every vowel appears at least once.
3. Maximum Order Volume
During the day, a supermarket will receive calls from customers who want to place orders. The supermarket manager knows in advance the number of calls that will be attempted, the start time, duration, and order volume for each call. Only one call can be in progress at any one time, and if a call is not answered, the caller will not call back. The manager must choose which calls to service in order to maximize order volume.
Example:start = [10, 5, 15, 18, 30]
duration = [30, 12, 20, 35, 35]
volume = [50, 51, 20, 25, 10]
The table representation of the example:
Caller | Start time | Duration | Order volume |
---|---|---|---|
1 | 10 | 30 | 50 |
2 | 5 | 12 | 51 |
3 | 15 | 20 | 20 |
4 | 18 | 35 | 25 |
5 | 30 | 35 | 10 |
4. Drawing Edge
Given a number of vertices, determine the number of ways these vertices can form a graph. The graph may be disjoint, so it is not necessary to connect all vertices. The answer may be very large, return its value modulo 109+710^9+7109+7.
Note: Two ways of drawing edges are considered different if at least one pair of vertices has a different connection or the number of edges is different.
Example:n = 4 (number of vertices)
From four vertices, 64 graphs are possible. Sixteen of them are shown (visualization in the image).
CSOAhelp长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
CSOAhelp consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.