一起来看看tiktok的本周真题吧

其中2道选择题非常简单，我们一起来看看其中3道原创的算法题。如果这周觉得没有信心，可以放弃不做，等待3月25日开始的新一轮。

一个经常被问到的问题是intern/grad，前端/后端 等等岗位的题目是否一样，我这里很确认的说，tiktok对所有岗位所有候选人使用的相同的题库，过去的一段时间内是有超过5道题来随机选（大概9选5），近3个月的时间内全部是一模样的选择题，可能出高质量的原创题对于tiktok来说也是个非常重的负担吧。

Let’s take a look at tiktok’s real questions for this week Two of the multiple-choice questions are very simple. Let's take a look at three of the original algorithm questions. If you don’t feel confident this week, you can give up and wait for the new round starting on March 25.

A question that is often asked is whether the questions for intern/grad, front-end/back-end and other positions are the same. I can confirm here that TikTok uses the same question bank for all candidates for all positions. In the past period of time, There are more than 5 questions to choose randomly (about 5 out of 9). In the past 3 months, they have all been the same multiple choice questions. Maybe producing high-quality original questions is also a very heavy burden for tiktok.

3. **URL Hashing**

Implement an algorithm to hash a URL as described.

Suppose the given URL `url`

of length *n* is to be hashed with a string `hash_string`

of length *m*. Given an integer *k*, run the `url`

through the following algorithm:

- Divide the URL into blocks of size
*k*starting from the left. The last block can be smaller than*k*. For example, if`url`

= "https://xyz.com" and*k*= 4, the blocks are ["http", "s://", "xyz.", "com"]. - The values of the English characters 'a', 'b', ..., 'z' are 0, 1, ..., 25 respectively, and that of ':', '/', and '.' are 26, 27, and 28 respectively. Thus the hash value of the block "s://" will be 19 + 26 + 27 + 27 = 98.
- For each URL, find the hash value of each block. The hash value is the sum of the values of each character.
- Replace the block with the (hash value of the block modulo
*m*)^th character of the string`hash_string`

.

Given the string `url`

, `hash_string`

, and an integer *k*, find the hashed string.

**Example**

Suppose `url`

= "https://xyz.com", `hash_string`

= "pqrst", and *k* = 4.

Block | Hash Value | Hash Character |
---|---|---|

http | 7 + 19 + 19 + 15 = 60 | hash_string[60 % 5] = 0 = p |

s:// | 18 + 26 + 27 + 27 = 98 | hash_string[98 % 5] = 3 = s |

xyz. | 23 + 24 + 25 + 28 = 100 | hash_string[100 % 5] = 0 = p |

com | 2 + 14 + 12 = 28 | hash_string[28 % 5] = 3 = s |

Each hash value is divided by the length of `hash_string`

, or 5 in this case. The remainders point to the characters in `hash_string`

, and the answer is "psps".

**Function Description**

Complete the function `getHashedURL`

in the editor below.

`getHashedURL`

has the following parameters:

`string url`

: the input URL`string hash_string`

: a hash string for mapping`int k`

: the block sizes

**4. Minimum Buckets**

Given an array of *n* integers, `arr`

, distribute its elements into the minimum possible buckets. Buckets can hold any number of elements, but a bucket of *x* elements must have more than floor(*x*/2) elements of the same value. Determine the minimum number of buckets required.

**Example** n = 5 arr = [1, 2, 2, 3, 4]

At least 3 buckets are required. One possible distribution is [2, 2, 3], [1], [4].

**Function Description** Complete the function `minimumBuckets`

in the editor below.

`minimumBuckets`

has the following parameters:

`int arr[n]`

: the array

**Returns**

`int`

: the minimum number of buckets required

**Constraints**

- 1 ≤ n ≤ 10^5
- 1 ≤
`arr[i]`

≤ n

**5. The Three Knights**

Given a grid with *n* rows and *m* columns, count the number of possible placements for three knights on the grid such that no two knights can counter each other. Note that no two knights can be placed in the sa... (剩余部分将于本周五公布，请关注收藏本站 The remainder will be announced this Friday， Please follow and bookmark this site)

代做OA是我们的一项收费服务，对于任意限时在2小时以下的OA，我们将确保你获得满分，它仅售359美元。不仅仅是tiktok的OA，像Amazon Meta Netfix的OA我们都可以协助您获得满分。我们将在你做题的时候远程控制你的屏幕并给出答案，即使是最严格的考试平台我们也能够绕过。我们同时也提供面试辅助和代面试的服务，如果你对此感兴趣请查看这里。有任何疑问欢迎联系我。

Doing OA on behalf of us is a paid service. For any OA with a time limit of less than 2 hours, we will ensure that you get full marks. It only costs $359. Not only tiktok's OA, but also Amazon Meta Netfix's OA, we can help you get full scores. We will remotely control your screen and give you the answers as you work on the questions, allowing us to bypass even the most rigorous testing platforms. We also provide interview assistance and interview services. If you are interested in this, please check here. If you have any questions, please contact me.