注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
面完了,感觉不是很好。
第一题是新题,没在笔记上,各个论坛也搜不到,当时很慌。
大概就是给一个list,len是n,比如说[2,1,2,3]
需要生成一个由1-n的integer组成的permutation
使information gain最大
the information gained for some permutation p of n integers for the array data is equal to the sum of i * data[p[i]]. For example, if data = [2, 4, 5, 3] and p = [2, 1, 3, 4], then the information gained is 1 * data[2] + 2 * data[1] + 3 * data[3] + 4 * data[4] = 1 * 4 + 2 * 2 + 3 * 5 + 4 * 3 = 4 + 4 + 15 + 12 = 35.
如果information gain最大的permutation有多个的话,那么返回lexi最小的那个permutation
example:
输入如果是2,1,2,3
n就是4
permutation就是1,2,3,4的排列
答案应该是[2,1,3,4]
其实不难,但人生第一个OA,太紧张了,脑子一片空白。后来鼓捣了半天做出来了不超时的解,但代码风格很乱,也没有clean up就提交了,感觉可能会凉凉。
第二题是leetcode discussion之前share的原题:
At Amazon, a user owns a unique tool called the "Parentheses Perfection Kit.&qu您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 amazon-oa2-work-simulation%2F" rel="nofollow noopener" target="_blank">https://programhelp.net/amazon-oa2-work-simulation/
性格测试没啥好说的,根据LP选择就好。
补充内容 (2025-01-17 01:03 +08:00):
求大家加点米,新人看帖子不容易。感恩。 |