Question: A content creator is taking on a challenge to get really good at TikTok. Instead of regular activities, they decide to focus on a playlist
A content creator is taking on a challenge to get really good at
TikTok. Instead of regular activities, they decide to focus on a
playlist of TikTok reels.
To master TikTok, they set a goal to watch the reels a total of
times. But they want to do this in the least amount of time
possible. Here's how it works:
First Time Watching: The creator must watch each reel in the
playlist completely the first time. The time it takes is
initialWatchi repeatWatchi for the ith reel.
Rewatching: After the first complete watch, they can rewatch
any reel in any order. For rewatching, they only spend
repeatWatchi minutes per reel.
Sequential Viewing: When watching the playlist for the first
time, they must watch the reels in order, from the first to the
last.
Total Viewings: The total number of viewings including first
time and rewatching across all reels must add up to
Optimization Goal: The creator aims to minimize the total time
spent watching the reels while fulfilling the above constraints.
This involves strategically planning which reels to repeat and
how often, given the reduced time for repeat viewings.
Function Description
Complete the function optimizeTikTokWatchTime in the editor
below.
optimizeTikTokWatchTime has the following parameters:
int : an integer denoting the total number of reel viewings
the creator aims to complete.
int initial Watch an integer array denoting the minutes to
watch the th reel for the first time.
int repeatWatchn an integer array denoting the minutes to
rewatch the th reel.
Returns
int: an integer denoting the minimum total minutes required
for the creator to reach their target count of reel viewings.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
