Question 1: Scheduling Optimization Problem
A scheduler manages multiple processes with priorities represented by the letters a
, b
, and c
. Its goal is to optimize the schedule to achieve a specific sequence.
Available Operations:
- Choose a process with priority
a
,b
, orc
. - Insert the chosen process into the scheduling queue at any position.
Objective:
Determine the minimum number of scheduling operations required to ensure that the scheduling queue follows the repeating pattern "abc"
.
Example:
- Input:
s = "abb"
- Transformation: Transform the queue to
abcabc
by inserting two lettersc
and one lettera
. - Explanation: The string
abcabc
is the concatenation of"abc"
two times. - Result: The minimum number of scheduling operations required is
3
.
Function Description:
Complete the function findMinOperations
in the editor below.
Parameters:
string s
: the scheduling queue.
Returns:
int
: the minimum number of operations required to make the queue a concatenation of"abc"
several times.
Constraints:
- The length of
s
satisfies1 ≤ |s| ≤ 100,000
. - The string
s
consists only of characters'a'
,'b'
, and'c'
.
Question 2: Cost Optimization in Edge Computing
In an edge computing environment, required hardware includes edge devices, input peripherals, and bundles that encompass both types. Each resource comes at a cost:
- Edge devices are priced at
edgeDeviceCost
. - Input peripherals are priced at
inputPeripheralCost
. - Bundles are priced at
bundleCost
.
Objective:
Optimize the procurement of resources to minimize costs while ensuring that the environment is equipped with all the essential resources. The flexibility allows for a combination of individual items and bundles to meet the requirements of:
x
edge devices.y
input peripherals.
Example:
- Input:
edgeDeviceCost = 1
inputPeripheralCost = 2
bundleCost = 2
x = 2
y = 1
- Strategy:
- Purchase 1 edge device and 1 bundle pack, totaling
1 + 2 = 3
units.
- Purchase 1 edge device and 1 bundle pack, totaling
- Result: The minimum total expenditure is
3
.
Function Description:
Complete the function getMinimumCost
in the editor below.
Parameters:
int edgeDeviceCost
: the cost of an edge device.int inputPeripheralCost
: the cost of an input peripheral.int bundleCost
: the cost of a bundle containing both an edge device and an input peripheral.int x
: the number of edge devices required.int y
: the number of input peripherals required.
Returns:
long
: the minimum expenditure necessary to ensure that the edge computing environment is fully equipped.
Constraints:
- All costs and requirements satisfy
1 ≤ edgeDeviceCost, inputPeripheralCost, bundleCost, x, y ≤ 1,000,000,000
.
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We 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.