首先仍然是限时110分钟,7道题。
私信我的同学不要求 NG / intern 某某岗位的题了,所有岗位,所有地区的题目都是一样的,只要在这个时间段内。
Firstly, it is still limited to 110 minutes and consists of 7 questions.
The questions for all positions and regions are the same, as long as they are within this time period.
1. Securely Managing User Access in a Multi-Tenant System
Your multi-tenant system at TikTok requires secure management of user access to ensure that tenants cannot access each other's data. Which access control model would best support this requirement?
Pick ONE option:
- Discretionary Access Control (DAC)
- Mandatory Access Control (MAC)
- Role-Based Access Control (RBAC)
- Attribute-Based Access Control (ABAC)
2. Optimizing CPU Utilization in a Multi-Core System
Your application at TikTok needs to optimize CPU utilization across multiple cores to achieve maximum performance. Which of the following techniques would best distribute workloads across multiple cores?
Pick ONE option:
- Single-threaded execution
- Task parallelism
- Instruction-level parallelism
- Memory-mapped I/O
3. Ensuring Data Integrity in a Distributed File System
Your distributed file system at TikTok needs to ensure data integrity across multiple nodes, even in the presence of network failures. Which of the following techniques would best ensure data integrity?
Pick ONE option:
- Data striping
- Checksum verification
- Data compression
- File versioning
4. Implementing Real-Time Data Analytics
TikTok needs to implement a real-time data analytics platform that processes and analyzes incoming data streams with minimal latency. Which data processing model would best support real-time analytics?
Pick ONE option:
- Batch processing
- Stream processing
- Micro-batch processing
- Interactive processing
5. Securing Data in Transit
To protect sensitive data transmitted between TikTok's data centers, robust encryption protocols need to be implemented. Which encryption protocol would best secure data in transit?
Pick ONE option:
- AES
- RSA
- TLS
- SHA-256
6. TikTok Balanced Clips
TikTok creates random clips made up of lowercase English letters.
A clip is called "smooth" if the difference between any two letters next to each other is not bigger than a number called diff
.
The difference between two letters, x
and y
, is how far apart they are in the alphabet. For example, the difference between 'a' and 'z' is 25, and between 'f' and 'c' is 3.
- If
diff = 3
, then the clip "ac" is smooth because the difference between 'a' and 'c' is 2, which is less than or equal to 3. However, the clip "az" is not smooth because the difference between 'a' and 'z' is 25, which is greater than 3.
You are given two numbers: clipLength
(the number of letters in the clip) and diff
(the maximum allowed difference between two letters next to each other). Your job is to find how many smooth clips of length clipLength
can be made. Since the number could be very large, give the answer as the result modulo 10^9 + 7.
Example:
clipLength = 2
diff = 3
Consider the following strings of length 2:
Produced Word | Is Balanced? | Remarks |
---|---|---|
"ad" | Yes | Difference between 'a' and 'd' is 3, i.e., ≤ 3 |
"za" | No | Difference between 'z' and 'a' is 25, i.e., > 3 |
"zx" | Yes | Difference between 'z' and 'x' is 2, i.e., ≤ 3 |
"rk" | No | Difference between 'r' and 'k' is 7, i.e., > 3 |
"yy" | Yes | Difference between 'y' and 'y' is 0, i.e., ≤ 3 |
Other examples of smooth clips for diff = 3
include "ab", "ac", "df", "zz", and "op".
The total number of smooth clips of length 2 for diff = 3
is 170. So, the answer is 170.
Function Description Complete the function countBalancedClips
in the editor below.
countBalancedClips
has the following parameters:
int clipLength
: the length of the clipsint diff
: the maximum allowed difference between adjacent characters
Returns
int
: the total number of balanced clips of lengthclipLength
, modulo 10^9 + 7
Constraints
- 2 ≤ clipLength ≤ 10^5
- 1 ≤ diff ≤ 25
Solution Approach:
- Dynamic Programming (DP):
- Define
dp[i][j]
as the number of smooth clips of lengthi
that end with the letter corresponding toj
(0 for 'a', 25 for 'z').
- Define
- Base Case Initialization:
- For clips of length 1, all single letters are valid, so initialize
dp[1][j] = 1
for allj
in the range 0-25.
- For clips of length 1, all single letters are valid, so initialize
- DP Transition:
- For each clip length
i
, updatedp[i][j]
based on valid previous letters. - Use the
diff
constraint to limit transitions between letters.
- For each clip length
- Modulo 10^9 + 7:
- Use this to handle large numbers during calculations.
The final answer is the sum of all possible dp[clipLength][j]
values, modulo 10^9 + 7.
Let me know if you need a more detailed explanation or code implementation.
7. TikTok Server Network Optimization
TikTok is growing, and the developers need more servers to keep up with all the new users. They have installed n servers across different locations, and each server is placed on a large grid. The i-th server is located at the point (x[i], y[i]) on this grid..... Question 7, contact me to obtain
第6题和第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.