📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 20
跳转到指定楼层
上一主题 下一主题
收起左侧

[TikTok OA] AMS Grad Assessment 2025 Start

全局:

2024(10-12月) 码农类General 硕士 全职@Bytedance - 网上海投 - 在线笔试  | 😐 Neutral 😐 Average | Other | 应届毕业生
本帖最后由 thereggss 于 2024-11-16 22:24 编辑

5个选择2个大题,总共110分钟:


第一题:


选了第3个


第二题:


选了第1个




第三题:

选了第3个


第四题:

选了第2个



第五题:

选了第2个




第六题:
6. TikTok Reel lmpact
In the dynamic landscape of TikTok, creators are in a constant race to boost their videos' engagement and reach by leveraging new features that enhance their content.
Each creator starts with a set of mvideos represented by initialReellmpacts, which indicates the baseline popularity of each reel. For next n days, TikTok releases new trending features represented by newReellmpacts, with each feature offering an additional boost to the creator's existing reels.


On each of the next n days, the following takes place:
The creator appends the new features represented by newReellmpacts[i] (where 0 s i< n) to their current reels
Review the updated lineup, select the k-th most impactful reel based on its popularity, and add its impact value to their total impact score


For example, if k = 1, the creator selects the reel with the highest popularity; if k= 2, the creator selects the reel with the second highest popularity, and so on.


Given two integer arrays, initialReellmpacts and newReellmpacts of length m and n respectively and an integer k, The task is to calculate the creator's total impact score after incorporating all elements fromnewReellmpacts across n days.


Note: The initial impact score of the creator is considered to be the k-th highest impact value from the initial set of initialReellmpacts.


Example
m=2
initialReellmpacts =[2, 3]
n=3
newReellmpacts =[4, 5, 1]
k=2


The initial impact score of the creator is 2nd highest impact value from the initial set of initialReellmpacts =[2, 3]. Thus,impact score=2
Over the next n days the following process unfolds:


Index, newReellmpacts[i], currentreelsimpact, k-th highest, impact score
0, 4, [2, 3, 4], [2, 3, 4], 3, 2+3=5
1, 5, [2, 3, 4, 5], [2, 3, 4, 5], 4, 5+4=9
2, 1, [2,3, 4, 5,1], [1, 2, 3, 4, 5], 4, 9+4=13


Day 1: The creator appends a new reel with an impact of 4, resulting in [2, 3, 4], and selects the 2nd highest impact of 3, making impact score 2+3 =5.
Day 2: The creator appends a new reel with an impact of 5, resulting in [2, 3, 4, 5], and selects the 2nd highest impact of 4, bringing total impact score to 5 +4=9.
Day 3: The creator appends a new reel with an impact of 1, resulting in [1, 2, 3, 4, 5], and selects the 2nd highest impact of 4, making total impact score to 9 +4= 13.


Therefore the creator's total impact score after incorporating all elements from newReellimpacts across given n days is 13.
Hence return 13 as the answer.


Function Description
Complete the function getTotalImpact in the editor below.


getTotalImpact has the following parameter(s):
int initialReellmpacts[m]: The impact of initial m reels
int newReellmpacts[n]: The impact of the new n reels that appear one by one
int k: The fixed choice made by the creator, representing the position of the most impactful reel selected


Returns
long: The total impact achieved by the creator after incorporating all elements from newReellmpacts.


我的答案:

test cases 16/16


第七题:
7. Maximize Throughput
In ByteDance's vast network of data centers, millions of interconnected servers process content reguests, handle user interactions, and deliver data to users globally. Each server is part of a dynamic task execution flow, represented by an array serverTasks, where each entry in the array indicates the next server in the chain that will handle a task.


Optimizing the data pipeline requires careful management of these task handoffs. Once a task is picked up by server i, it triggers a dependency on server serverTasks[i], transferring the load there. However, this data transfer disables both servers iand serverTasks[i] from participating in any further task handoffs, as they are locked due to processing the current load. Therefore, selecting the right servers and managing the chain reactions of these task handoffs is crucial for maximizing throughput.


Each server at index i points to the next server serverTasks[i], where the task is transferred. Once this transfer occurs, both the sending server and the receiving server become unavailable for subsequent tasks. Your challenge is to select servers in such a way that maximizes the overall throughput score. The throughput score is determined by the sum of the indices of the servers where tasks are successfully handed off.


Your task is to analyze this network of server-to-server task handoffs, navigate the dependencies. and determine the maximum possible throughput score that can be achieved by optimally choosing the task handoffs.
Given the array serverTasks, calculate the maximum throughput score achievable by performing these operations in the most efficient way.


Example
n=3
serverTasks =[0, 1, 2]


We first select the server at index 0. lt points to itself (server 0), and its throughput is 0. So, the current total throughput is 0. Note that server 0 is now blocked.
Next, we select the server at index 1. lt points to itself (server 1), and its throughput is 1. So, the current total throughput becomes 0 + 1 = 1. Note that both servers 0 and 1 are now blocked.
Then, we select the server at index 2. lt points to itself (server 2), and its throughput is 2. So, the current total throughput becomes 0+1+2= 3.
All servers are now blocked.
Thus, the maximum achievable throughput score is 3.


Function Description
Complete the function calculateMaxProcessingThroughputin the editor below


calculateMaxProcessingThroughput has the following parameter(s):
senverTasks[n]: An array of integers where each element indicates the next server where the task is to be transferred.
Returns
long: The maximum throughput score achievable.


Explanation
serverTasks=[3, 0, 1, 2]
We first select the server at index 2(serverTasksl[i] = 1), which points to index 1(serverTasks[1] = 0) and its throughput is equal to 1. So, the current total throughput is 1. Note that both i= 1 and j= 2 are now blocked.


Next, we select the server at index 3(serverTasks[i]= 2), which points to index 1 but index 1 is blocked. So, the current total throughput becomes 1 + 2 = 3. Note that now i= 1, 2, 3 are now blocked.


Finally, we select the server at index 0(serverTasks[i] = 3), which points to index 3 but index 3 isblocked. So, the current total throughput becomes 1+2+3= 6.


All servers have been blocked now.


Thus, the maximum achievable throughput score is 6.


For more clarity, we show one more way of choosing indices for same sample:
serverTasks =[3, 0,1, 2]
We first select the server at index 0(serverTasks[i] = 3), which points to index 3(serverTasks[3]= 2) andits throughput is equal to 3. So, the current total throughput is 3. Note that both i= 0 and i= 3 have been blocked now.
Next, we select the server at index 2(serverTasks[i] = 1, which points to index 1 and blocks both i= 1 and i=2.
Since the throughput at index 2 is equal to 1, the total current throughput becomes 3 +1 =4.
All servers are now blocked. However, note that this achievable throughput score is 4, although it is not optimal


test case:
[2, 1, 0]  正确答案输出3
[3, 0, 1, 2]  正确答案输出6
[0, 4, 2, 1, 3] 正确答案输出9


test cases 4/16,实在跑不对,没搞出来,有思路的大佬可以分享一下


最后求大家加米,感谢!

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x

评分

参与人数 10大米 +19 收起 理由
微信用户_52fbcc7 + 1 给你点个赞!
coconut35A + 1 很有用的信息!
potatoHua + 1 赞一个
微信用户_3b61r + 1 赞一个
HNO333333 + 1 给你点个赞!

查看全部评分


上一篇:Nvidia 第一轮 面经
下一篇:调温 缅镜 围殴
全局:
匿名用户 发表于 2024-11-17 01:11
Q7是出题组翻车了,不是你的思路有问题,Tiktok的出题组经常出这种幺蛾子
修改一个描述就可以变得超级简单 ...

你这个过case也是错的骗人的好吧。。。不是receiving不blocked了,是receiving的 sending 还是要block 的,不过receiving 可以remain  receive了。
回复

使用道具 举报

全局:
这题看懂了很简单,图里面找环,去掉环中最小值求和就行了。
回复

使用道具 举报

全局:
这次的oa太搞了,q7怎么都ac不了
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-9OAUB  2024-11-17 17:11:28
❌ 3
Q7是出题组翻车了,不是你的思路有问题,Tiktok的出题组经常出这种幺蛾子
修改一个描述就可以变得超级简单
不清楚成绩是否算数,如果Tiktok一直不发现,这周AC的人会超级少
具体可以看这篇文章

https://csoahelp.com/2024/11/17/ ... 9%9D%A2-vo-support/
回复

使用道具 举报

🔗
 楼主| thereggss 2024-11-18 06:40:33 | 只看该作者
全局:
OA王 发表于 2024-11-17 01:10
Q7是出题组翻车了,不是你的思路有问题,Tiktok的出题组经常出这种幺蛾子
修改一个描述就可以变得超级简单 ...

原来如此呀,害我昨天郁闷了半天
回复

使用道具 举报

🔗
opopxps 2024-11-18 10:08:39 | 只看该作者
全局:
想请问楼主 serverTasks=[3, 0, 1, 2]的解释是官方的解释吗?感谢
回复

使用道具 举报

🔗
rennicorn 2024-11-18 10:38:28 | 只看该作者
全局:
q1 q2没看懂啥意思啊?提供的代码不就是正确的嘛?
回复

使用道具 举报

全局:
Q7真的看不懂...
回复

使用道具 举报

🔗
 楼主| thereggss 2024-11-18 13:55:22 | 只看该作者
全局:
opopxps 发表于 2024-11-17 18:08
想请问楼主 serverTasks=[3, 0, 1, 2]的解释是官方的解释吗?感谢

是的,是官方的
回复

使用道具 举报

🔗
 楼主| thereggss 2024-11-18 14:03:17 | 只看该作者
全局:
rennicorn 发表于 2024-11-17 18:38
q1 q2没看懂啥意思啊?提供的代码不就是正确的嘛?

意思就是下列哪一行代码实现了题目里面问的功能,第一题我选的4,写错了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表