本次的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. TikTok Comment Moderation
TikTok wants to delete inappropriate comments from a doubly linked list of comments. Write a pseudo-code to delete a comment node target
from the list.
Pick ONE option:
if (target.prev != null) { target.prev.next = target.next; } if (target.next != null) { target.next.prev = target.prev; } target = null;
if (target.prev != null) { target.next.prev = target.prev; } if (target.next != null) { target.prev.next = target.next; } target = null;
if (target.prev == null) { target = target.next; } else { target.prev.next = target.next; if (target.next != null) { target.next.prev = target.prev; } } target = null;
if (target.prev == null) { target.next.prev = null; } else { target.prev.next = target.next; } if (target.next == null) { target.prev.next = null; } else { target.next.prev = target.prev; } target = null;
2. TikTok Video Navigation
TikTok uses a stack to keep track of the previous videos watched by a user. Write a pseudo-code to implement the "go back" functionality, which pops the last watched video from the stack and returns it.
Pick ONE option:
if stack is not empty return stack.pop() else return null
if stack is empty return stack.pop() else return null
if stack is not empty return stack.peek() else return null
if stack is empty return stack.peek() else return null
4. TikTok User Hierarchy
TikTok uses a binary search tree (BST) to store user IDs for quick access. Choose the correct pseudo-code to insert a new user ID, userID
, into the BST.
Pick ONE option:
if (root == null) { root = newNode(userID); } else { current = root; while (true) { if (userID < current.value) { if (current.left == null) { current.left = newNode(userID); break; } else { current = current.left; } } else { if (current.right == null) { current.right = newNode(userID); break; } else { current = current.right; } } } }
current = root; while (current != null) { if (userID < current.value) { if (current.left == null) { current.left = newNode(userID); break; } else { current = current.left; } } else { if (current.right == null) { current.right = newNode(userID); break; } else { current = current.right; } } }
if (root == null) { root = newNode(userID); } else { current = root; while (current != null) { if (userID < current.value) { if (current.left == null) { current.left = newNode(userID); break; } else { current = current.left; } } else { if (current.right == null) { current.right = newNode(userID); break; } else { current = current.right; } } } }
if (root == null) { root = newNode(userID); } else { current = root; while (true) { if (userID > current.value) { if (current.left == null) { current.left = newNode(userID); break; } else { current = current.left; } } else { if (current.right == null) { current.right = newNode(userID); break; } else { current = current.right; } } } }
6. TikTok Shopping Spree
Alex is a TikTok influencer who loves shopping online and sharing his latest hauls with his followers. He’s super excited about buying several products from an e-commerce website to feature in his next video. Each item on his shopping list has its own price, and Alex wants to show his followers how to get the best deals.
Alex has a number of discount vouchers that he can use on any of his purchases. These vouchers offer a unique discount mechanism: the more vouchers used on a single item, the greater the discount. For instance, for each voucher used on an item, the price of that item is halved. If multiple vouchers are used on the same item, the price is halved repeatedly. The discount can be represented by the following formula:
discounted_price=p2k\text{discounted\_price} = \frac{p}{2^k}discounted_price=2kp
where:
- ppp is the original price of the item,
- kkk is the number of vouchers used on that item.
Alex needs to figure out the minimum total cost he'll need to pay to buy all the items he wants while using his vouchers as effectively as possible. Can you help Alex make his followers proud with his savvy shopping skills?
Example
Input:
vouchersCount = 3
prices = [8, 2, 13]
Output:
9
7. TikTok Server Optimization
TikTok is organizing a grand TikTok event and wants to optimize the content delivery routes for the users. They have numServers
servers numbered from 1 to numServers
. The servers will be arranged in a sequence as follows: [1, 2, 3, ..., numServers].
The company has a list of ..... 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.