本次Tiktok OA笔试题仍然是由5个选择题和2个算法题构成,本文将披露其中的第二题和第六题,让我们一起来看看吧。
This Tiktok OA written test still consists of 5 multiple-choice questions and 2 algorithm questions. This article will disclose the second and sixth questions, let's take a look together.
2. TikTok Notification Priority
TikTok uses a max-heap to manage notification priorities. Write a pseudo-code to remove the highest priority notification from the max-heap.
Pick ONE option:
- If heap is not empty
return heap.extractMax()
else
return "Heap is empty" - If heap is empty
return heap.extractMax()
else
return "Heap is empty" - If heap is not empty
return heap.peek()
else
return "Heap is empty" - If heap is empty
return heap.peek()
else
return "Heap is empty"
6. ViralContentBalancer
The TikTok engineering team is developing a new feature for analyzing viral trends by studying content sequences represented by a string content of length n, consisting of lowercase alphabets. The team has discovered that to make a video go viral, each element (character) in the content sequence should have an equal frequency.
In one operation, a character can be appended or removed from the content string. Your task is to find the minimum number of operations required to balance the frequency of all characters in the content sequence.
Example
Input:content = "xzyzxa"
Output:2
Explanation:
For the content "xzyzxa"
, the characters 'z' and 'x' have higher frequencies than others. To balance the frequency of all characters, one possible solution is to append one 'a' and one 'y', resulting in content = "xzyzxaya"
. Alternatively, removing one 'x' and one 'z' would also achieve a balanced distribution, with the new content sequence content = "xyza"
. Both approaches result in a valid balanced content sequence, and the minimum number of operations required is 2.
Function Description
Complete the function balanceContent
in the editor below.balanceContent
has the following parameter:
- string content: the original content sequence.
Returns
- int: the minimum number of operations to balance the content sequence.
7. TikTok Credits Distribution Challenge
In the grand finale of a prestigious TikTok tournament, the organizers have prepared several boxes filled with TikTok credits as prizes for the participants. They know exactly how many participants will compete in the tournament and want to ensure that every participant receives an equal number of TikTok credits to avoid any disappointment.
值得注意的是,第七题经过我们专家团队的鉴定,是出题者犯了一些错误导致无法通过测试用例。Tiktok官方对此将会如何处理我们不得而知,但是拥有OA机会的同学一定不要错过任何一个机会,一定要完成本次OA
It is worth noting that the seventh question, after being evaluated by our expert team, was caused by some mistakes made by the questioner, which resulted in the failure to pass the test case. We don't know how Tiktok will handle this, but students who have the opportunity for OA must not miss any chance and must complete this OA
Contact me for free access to the main text of other questions
我们长期稳定承接各大科技公司如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.