本次的TikTok线上笔试依然是110分，共7道题目，其中5个选择题2个算法题。无论是哪个岗位或地区，题目基本一致，难度适中。准备充分的同学应该可以顺利完成。通过这次OA，大家能很好地展示自己的技术实力。

**Introduction:**

The latest TikTok online assessment remains consistent with 110 points across 7 questions. The questions are identical for all positions and regions, with a moderate difficulty level. Well-prepared candidates should find it manageable and an opportunity to showcase their technical skills.

**1. Implementing Load Balancing in a Microservices Architecture**

TikTok is adopting a microservices architecture for its applications. Efficient load balancing is critical to ensure that services remain responsive under varying loads. Which load balancing strategy would best distribute requests across microservices?

**Pick ONE option:**

- Round Robin
- Least Connections
- IP Hash
- Random

**2. Optimizing Warehouse Inventory with Balanced Binary Search Trees**

A large logistics company stores its inventory data in a system. The data includes item IDs and quantities in stock. As the company expands, it becomes increasingly difficult to efficiently manage inventory searches, updates, and deletions. The CTO decides to redesign the inventory management system to ensure that search, insert, and delete operations remain efficient even as the number of items grows significantly. Which data structure is the best choice for this scenario?

**Pick ONE option:**

- Unbalanced Binary Search Tree (BST)
- Balanced AVL Tree
- Circular Queue
- Doubly Linked List

3.**TikTok uses a circular queue to manage tasks. Choose the correct pseudo-code to implement the dequeue operation for removing a task from the queue.**

**Pick ONE option:**

`if (queue is empty) {`

`return "Queue is empty";`

`} else {`

`task = queue.remove();`

`return task;`

`if (queue is full) {`

`return "Queue is empty";`

`} else {`

`task = queue.remove();`

`return task;`

`if (queue is empty) {`

`task = queue.remove();`

`return task;`

`} else {`

`return "Queue is empty";`

`if (queue is empty) {`

`return "Queue is empty";`

`}`

`task = queue.remove();`

`return task;`

**6. Maximize Engagement**

You are a data analyst at the popular social media company TikTok. Your task is to optimize user engagement on TikTok-like video reels by developing an "engagement boost" algorithm that increases user interaction on the platform.

You are provided with two datasets: **views** and **likes**, both of the same length, where each entry represents the views and likes on a particular video. The objective is to maximize the "engagement score," defined as the sum of all `likes[i]`

where `likes[i]`

exceeds `views[i]`

.

However, there's a catch! You are allowed to rearrange the likes dataset to maximize the engagement score, but the views dataset remains fixed. Your challenge is to design an efficient algorithm that rearranges the likes dataset to achieve the highest possible engagement score while adhering to the constraint that the views dataset cannot be rearranged.

**Given:** Two arrays of integers, **views** and **likes**, your goal is to rearrange the elements of **likes** to maximize the engagement score.

**Example:**

`n = 5`

`views = [2, 3, 4, 5, 6]`

`likes = [4, 6, 5, 7, 3]`

The **likes** array can be rearranged to `[3, 4, 5, 6, 7]`

. Now, for each index, the likes array has integers greater than the corresponding values in **views**. Thus, the sum is `3 + 4 + 5 + 6 + 7 = 25`

.

**Function Description:** Complete the function `getMaxEngagementScore`

in the editor below.

`getMaxEngagementScore`

has the following parameters:

`views[n]`

: the fixed array of views per video.`likes[n]`

: the array of likes to be reordered.

**Returns:**

`long`

: the maximum possible engagement score.

I will now extract the second problem's text.

It seems that no text was extracted from the cropped image. I will retry the extraction by focusing on refining the area to better capture the content for the second problem.

It seems that text extraction for the second part was unsuccessful due to the cropping attempt. To proceed efficiently, I will manually transcribe the text from the second problem based on the image you provided.

Here is the transcription of the second problem:

**7. Influencers Squad**

Imagine you're a community manager at TikTok, tasked with building teams for a high-stakes influencer marketing campaign. You have a list of influencers, each with an engagement score based on their recent activity. Your goal is to form the largest squad of influencers who can collaborate seamlessly.

For any team to work well together, the difference between the engagement scores of two consecutive influencers in the squad must be either 0 or 1. If the difference between consecutive influencers is greater than 1, they won't vibe well!

Given the **engagement_scores** of `n`

influencers, your task is to find the largest possible squad where all members can collaborate smoothly.

Note: You are allowed to rearrange the influencers to maximize team potential!

**Example:**

`n = 5`

`engagement_scores = [12, 14, 15, 11, 16]`

Valid squads of influencers are `{11, 12}`

and `{14, 15, 16}`

. These squads have sizes 2 and 3, respectively, so the largest squad size is 3.

**Function Description:** Complete the function `findMaxSquadSize`

in the editor below.

`findMaxSquadSize`

has the following parameters:

`int engagement_scores[n]`

: the engagement scores of each influencer.

**Returns:**

`int`

: the largest possible squad size.

我们长期稳定承接各大科技公司如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.