查看: 763| 回复: 0
收起左侧

[应届生NG] Roblox OA

socute88 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   29
100%
0%
0

2024(10-12月)-CS硕士+fresh grad 无实习或全职 | 网上海投|BayArea湾区 码农类General全职@Roblox

注册一亩三分地论坛,查看更多干货!

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

x
. Χ
Roblox OA, 求大米!


题1:.--
There are some lamps placed on a coordinate line. Eachof these lamps illuminates some space around it within agiven radius. You are given the coordinates of the lampson the line, and the effective radius of each of the lampslight.
In other words, you are given a two-dimensional arraylamps , where lamps[i] contains information aboutthe ith lamp.
lamps[i][o] is an integer representing the lamp's coordinate,.google  и
lamps[i][1] is a positive integer representing the lamp's effective radius.
That means that the ith lamp illuminates everything in a range from lamps[i][0] lamps[i][l] to lamps[i][0]+ lamps[i][1]inclusive.
Your task is to find the number of integer coordinatesthat are illuminated by exactly 1 lamp.
Example
For lamps =[[-2,3],[2,3],[2,1]] ,the output should be solution(lamps)=6


题2:
Let's define a rhombic area of size r as the set of allcells that are less than r steps away (up, down, left, orright) from a given center cell in a matrix. This numberr is called the radius of the rhombic area.
In the image below, the black cell is the center of therhombic area, and every cell contains a numberrepresenting the distance to the center - the radius. Therhombic area of size r includes all cells with numbers1, 2 ,., r in them.
Cells with the same radius are colored in the same colorThe distance between a center cell (centerx, centerY) and another cell (cellx,celly)iscalculated as follows distance = abs(centerx-cellx)+ abs(centerY-cellY)+1,where abs(x)is an absolute value of x.
For each possible center cell of the matrix , findthe sum of all elements within the surrounding
rhombic area of size radius . Note. only conside!the rhombic areas whose elements all fit within thebounds of the matrix. check 1point3acres for more.
From among these sums, find the highest valueReturn an integer representing the highest sum. ..
Example
matrix=[
[0, 2,4,1,6,4],
[5, 1,3,4,1,5],
[0, 1,2,1,2,1],. ----
[1, 3,2,1,1,2],
[4, 1,3,6,5,  5],. 1point3acres
[6, 7,   5,3,  1,2]]
and radius = 3 . Χ
the output should be 35

评分

参与人数 1大米 +1 收起 理由
eveningstar + 1 给你点个赞!

查看全部评分


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

本版积分规则

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