📣 Back to School开学季 - VIP通行证5折优惠!蓝莓、Offer多多同步优惠
回复: 6
跳转到指定楼层
上一主题 下一主题
收起左侧

新鲜出炉亚麻OA

🔗
匿名用户-KBH1L  2021-12-19 14:11:24 |倒序浏览

2022(1-3月) 码农类General 硕士 全职@amazon - 网上海投 - 技术电面  | 😐 Neutral 😐 Average | Fail | 在职跳槽

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

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

x
本帖最后由 匿名 于 2021-12-19 00:27 编辑

几分钟前刚刚做完香蕉的OA第一题 是写一个comparator
Your team at Amazon has been contracted by a telecommunications company that is trying to upgrade junction boxes all over Techlandia. Some of the junction boxes have already been upgraded, and other boxes have not. Your task is to identify the oldest boxes that need to be upgraded first but leaving the newer model boxes so that they will not be prioritized.
All the junction boxes are identified by an alphanumeric identifier, followed by space delimited version information. The older generation uses space delimited lowercase English strings to identify the version, but the newer generation uses space delimited positive integers to identify the version. Your task is to sort the junction boxes in the following order:

1. The older generation junction boxes should be returned first, sorted by lexicographic ordering of alphabetic version.
2. If there are any ties in the older generation, ties should be broken by the alphanumeric identifier.
3. The newer generation boxes must all come after the older generation, in the original order they were given in the input.
Write a function or method to return a list of strings representing the correctly prioritized
orders according to this system.
Input
The input to the function/method consists of one
argument:
boxList, a list of strings representing all of the
identifiers and version information.

Output
Return a list of strings representing the correctly
prioritized orders according to this system.

Examples
Input:
boxList=
[vkc 82 011
[Leo first qpx]
[09z cat hamster]
[06f 12 25 61
[azO first qpx]
[236 cat dog rabbit snake]

Output:
[236 cat dog rabbit snake]
[09z cat hamster]
[azo first qpx]
[eo first qpx]
[ykc 82 01]
[06f 12 25 6]
Explanation:
The four old generation junction boxes should
come first, with the "cat dog rabbit snake" box
coming before the "cat hamster type". Since the
two boxes of type "first qpx" have the same
version information, they should come next, using
the "azo" identifier to come before the "eo"
identifier. Finally, the already upgraded junction
boxes should come last, in the original order, they
were provided in the file.

public static List‹String› sortBoxes (List‹String› boxList)

第二题我没想到更好的办法做,就写了Brute Force, 有些test超时了
没有截图,但是题目大概是给一个数组int[] eg.[3,5,-2],
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
output List<Long>

评分

参与人数 2大米 +6 收起 理由
葡萄的奶茶 + 5 很有用的信息!
KKKCCC + 1 很有用的信息!

查看全部评分


上一篇:亚麻virtual on site
下一篇:阿佛姆 sr offer以及应不应该加入问题
🔗
KKKCCC 2021-12-19 19:04:50 | 只看该作者
全局:
请问第二题是返回子序列还是和?
回复

使用道具 举报

全局:
KKKCCC 发表于 2021-12-19 03:04:50
请问第二题是返回子序列还是和?
是返回最大的K个和
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-DWJDR  2021-12-20 06:01:11
请问楼主是ng还是社招?

评分

参与人数 1大米 +1 收起 理由
chine + 1 赞一个

查看全部评分

回复

使用道具 举报

🔗
ElvisLin 2021-12-26 06:07:47 | 只看该作者
全局:
第二题原题应该是利口尔凌久久,find subsequence of length k with the largest sum?我想到的最优解是用min heap of k 来做,时间O(nlogk)
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-KBH1L  2021-12-26 12:32:46
匿名者 发表于 2021-12-19 16:01
请问楼主是ng还是社招?

我是社招做的OA
回复

使用道具 举报

🔗
jumpyrabbit 2021-12-27 01:52:29 | 只看该作者
全局:
heap sort?
回复

使用道具 举报

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

本版积分规则

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