4. Handling High Concurrency in Web Server
Your web server at TikTok needs to handle a high number of concurrent connections efficiently.
Which server architecture would best support high concurrency?
Pick ONE option:
- Multi-threaded server
- Event-driven server (selected)
- Forking server
- Single-threaded server
6. Optimize TikTok Reels Viewing
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 n
TikTok reels.
To master TikTok, they set a goal to watch the reels a total of m
times. But they want to do this in the least amount of time possible. Here’s how it works:
The complete version of question 6 will be released in the future
7. Tiktok Viral Challenge
In the competitive world of social media, especially on platforms like TikTok, creators are constantly battling to produce viral content. The stakes are high—every video segment counts. As a data analyst working for TikTok, you've been tasked with a critical mission: to help creators optimize their videos by identifying the most promising segments that could lead to viral success.
Each segment of a TikTok video has an engagement attribute, which reflects its potential to go viral. This attribute is represented as an integer array engagementArray
of size 26, corresponding to the letters of the alphabet ('a' to 'z'). Each element in this array is either 1
(indicating a viral segment) or 0
(indicating a non-viral segment).
The goal is to count all possible viral content combinations. A TikTok video is considered viral if the number of non-viral segments in any substring of the video does not exceed a given threshold k
. The video is represented by a string of length n
.
Given:
- A string
video
of lengthn
. - An integer
k
, the maximum allowed number of non-viral segments in a viral TikTok video. - An integer array
engagementArray
of size 26, where each element is either1
(viral) or0
(non-viral).
Find the number of unique non-empty substrings of the video that qualify as viral content.
Example:
Input:
video = "abc"
engagementArray = [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
k = 2
Output:
5
Explanation:
Analysis of all Teams:
------------------------------------
| Team | Number of weak players | Strength of the Team |
------------------------------------
| a | 1 | viral |
| b | 0 | viral |
| c | 1 | viral |
| ab | 1 | viral |
| bc | 1 | viral |
| abc | 2 | non-viral |
------------------------------------
Hence, there are 5 unique viral content formations.
Sample Output 0:
码14
Explanation:
Here are the 14 unique viral content formations:
- "a"
- "am"
- "e"
- "ea"
- "eam"
- "r"
- "re"
- "rea"
- "s"
- "st"
- "t"
- "tr"
- "tre"
Sample Case 1:
Sample Input 1:
video = "cdcdcd"
engagementArray = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
k = 1
Output:
5
Explanation:
Here are the 5 unique viral content formations:
- "c"
- "cd"
- "d"
- "dc"
- "dcd"
Contact me for free access to the main text of question 7
我们长期稳定承接各大科技公司如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.