亚麻近期面经合集1

亚麻OA面试

背景:6年工作经验,朋友内推的 Alexa.

题目无新意还是都是论坛上的大家见过的

  1. K nearset Ponits. 求最近K个点. 排序或者优先队列都可以
  2. pair IDs. 两个数组的数字配对, 然后找出最大的但不超过给定数字M的所有组合. 直接暴力两重循环即可

友情提醒一下新人

  1. 翻墙会好点
  2. 注意import
  3. 亚麻编辑器提示功能很弱, 稍微记一下比如排序的comparator写法或者一些类的位置之类的

亚麻onsite

背景:社招 general hiring, consumer org,hiring event

  1. 两人,一个有经验的shadow。 给一个长string 找包含一组string 最短 substring
  2. 一个不是这个org里的人,说这个org人手不够找他帮忙, 他想多锻炼一下以后做br,觉得互惠互利就来帮忙了。 如何让goodread 和亚麻共享书的review, 能自圆其说就好
  3. 一个国人大哥,用排除法觉得应该是br。 2sum(跪谢) 排序数组里面除了一个数只出现一次其他都出现两次。 求这个数。讲了算法, 没有写。
  4. island面积

很幸运四轮都没有烙印, 面的很顺。

BQ真的要准备一下,每轮都三四个问题。。。。。 感觉至少一半时间都在BQ,第二轮那人感觉是照着一个list在念问题,说他也没办法, 他后来问一个问题实在想不出来例子,他说算啦算啦,我们换一个。

补充内容 (2018-4-4 10:06):

第一个应该是 给一个stringlist表示一篇文章 一个string set表示keywords , 找 这篇文章中包含所有keyword 的最短范围。

Q&A:

Q:请问楼主 island面积 是利口那个题

A: leetcode 里没有,很简单的 给island一个点的坐标,问这个island的面积,就dfs / bfs 就可以了

Q: 楼主能说说第一题思路吗

A: leetcode有一样的题目,就是把char 变成string了,记不得题号了,类似题很多。 sliding window做就可以了

A:number of islands 1, 用 dfs 的时候记一下数就行了。 m_count++;

亚麻社招和new grad OA

背景:校招内推。我也不知道为什么,第一个做了之后没消息了,等了半天等了两轮校招oa, 做完之后又没消息。白白把亚麻家oa做了个遍

两种oa我都做了

社招:

k个最近的牛排馆

两个数组各选一个值加起来求和,要求这个和等于K那道题

校招:

oa1:

就是各种逻辑题,有大神整理的很仔细了

oa2:

work simulation好好做,不知道是不是因为这个我没拿到面试,也是看的地理的整理帖

coding: two sum那一道,第二道好像是k distinct string那道,很简单,记不太清楚了

亚麻新鲜面经OA1 + OA2 + FINAL VIRTUAL INTERVIEW

10月6号海投。

10月17号收到OA1, 10月24号做完。

10月25号收到OA2, 10月31号做完。(我老是拖到快deadline,大家不要学我)

11月9号收到Final virtual interview invitation, 45min, 一轮。

订了11月16号面试。看了11月12号到16号的vo,多都是讲讲OA2,有些小伙伴连bg都没被问,真的羡慕。

-oa1:

做了所以地里的面筋题,然后碰到了些没见过的:

ACFJ, CEHJ, PRUY, SUXZ, 选出不同的一个

bb c MN, dd e OP, gg f QP, mm n WX, 选出不同的一个

如果FASTER对应HCUVGT, 那么SLOWER对应啥?

-oa2:

地里的work simulation面筋帮助很大,一定要看。

coding是count substring with k distinct characters 和 maximum minimum path。

第一题用的bruteforce,第二题用dp。全部test cases都过了。

-final vo:

一开Amazon chime,看到个印度哥哥的名字,心凉了半截,很怕有口音听不懂。结果出现的是个白人大叔,在amazon工作了十几年,一共面了一个小时左右。

前二十分钟是bg,问了好多resume和tell me a time when的问题。比如说tell me a time you have to overcome a obstacle, tell me a time when you have to ask for help,tell me a time when you have to take a lead 等等。

问完bq,是二十五分钟的coding。本来说是要讲oa2的,后来不知道问什么变卦了,在share codepad上贴了一道题。不是很难,但是是我没复习到的binary tree的问题。心里一万只草泥马奔过,你不是要问oa2吗!!!能不能说话算话!!!anyway,是一题求maximum sum path的题,很基础,但是没复习到加上有点紧张,写得没有很完美,有个bug,最后改出来了。然后问我了time complexity,然后问我怎么优化,然后问优化的time complexity。

最后十五分钟是问问题,白人大叔讲了他很多在amazon的故事。然后就拜拜了,感恩节要到了,跪求不要挂我!!!

Q & A:

Q:你怎么知道本来要讲oa2?

A:面试官说了,i think we are supposed to cover your oa. 还问我可不可以。。。打开codepad后就变卦了= =

Q:你还想要多水…这还不够水吗?我觉得面试官是实在看不下去了。听朋友说,亚麻内部一直对new grad的low bar …

A:你说得对,对于其它公司的final round水到不行!!!我的意思是说比较一些很幸运的童鞋,我有个朋友跟我同一天面,别说coding了,bg都没被问。。。

Amazon OA2 Work Simulation | Keep Walking

目前两大原则:

  1. requirement排在第一, deadline第二
  2. 有manager出现的选项无脑选manager,manager就是一个组的代言人+保护伞,大哥自己人。

注意事项:

  1. 时间充足, 仔细读题, 慢慢做
  2. 那个打分并不是每个都要1, 2, 3, 4, 5, 因为你可以打比如2个5, 3个4也是可以的,所以还是很多变数的
  3. 记的每收到email就要看看, email中会有后面的题目需要的信息

13. Database metric generation

Please rate the effectiveness of each response option for meeting the deadline.

  1. Work on the project on your own putting in extra effort to finish on time.
  2. Work on the project on your own until Priya is available, then continue to work on it together.
  3. Work on the project with Ben being sure to watch his work closely because of this lack of experience.
  4. Tell your manager you will not be able to complete the project in the time available.
  5. Cut features from the product so you will be able to meet the two week deadline.
  6. Start working on the project right away with Ben. Then ask Priya to contribute what (left?)

Answer:

  • 一定要先告诉Manager有不能按时完成的风险, 所以4评5; 同时利用一切可以利用的资源来尽可能按时完成任务, 6评5;
  • 然后2, 3评4分吧, 利用了一部分资源
  • 1自己单干, 精神可嘉, 但是感觉浪费了点资源, 评3分吧
  • 5减功能, 这个还是算了吧, 宁愿自己苦一点, 也要争取按时完成计划啊, 评1分吧
  • 总结 344515

14. 别的Team要依赖于你的项目, 需要你把原先2周的活在用一周完成

Please rate the effectiveness of each response option for completing this work on time:

  1. Ask your whold team for help, explaining the urgency that another is blocked.
  2. Work with the Customer Incentives Team to identify the critical features that they need by the deadline and focus on those.
  3. Push the timeline back another week to ensure there is enough time for all work to be completed accurately.
  4. Ask your manager for help in determining the best approach to meet the new deadline.
  5. Put in extra hours yourself to make sure everything gets done on time.

Answer:

  1. 报告Manager是首要的, 所以4评5分; 利用一切可以利用的资源按时完成, 1评4分
  2. 5自己加班加点完成, 评3分
  3. 2跟别的Team商量着加功能, 评2分吧
  4. 3不能在规定时间内完成, 也没有沟通, 会影响其它Team的工作, 评1分
  5. 总结下来是 42153

15. 系统是否升级

Retail Website Team是我们的客户, 我们答应了他们要做两个features. 说咱们现在要帮人做两个feature,一个让100%用户爽,还有个让20%的用户爽。但是咱们现在还要升级一下系统,升级系统会让我们自己组爽,但是升级会推迟帮忙做的feature,不升级吧,以后升级之后还得做一遍。

这题中心是不升级,要做feature,因为feature可以让用户获得快感。(之前的想法:首先不升级,因为会block其他组。而且这个工具其实是更针对自己组方便的,要做的就是先把承诺的feature做好,然后找机会再搞这个升级。)

  1. 升级, 在deadline前完成feature 1, 在deadline后完成feature 2
  2. 升级, 把Retail Website Team的需求推后, 这样可以让我们更有效率的服务用户
  3. 不升级, 优先完成我们答应的features, 然后把我们其它项目的deadline向后推一下, 做系统升级,
  4. 不升级, 完成我们答应的features, 然后再找时间升级
  5. 升级, 把Retail Website Team的需求推后, 因为这样可以避免我们做同样的事两次
  6. 不升级, 因为这样对Retail Website Team没什么重大的影响, 我们要focus on Retail Website Team的需求上

Answer:

  • 首先是不升级吧, 虽然1很好, 也很合理, 但是如果客户至上的话, 还是优先满足客户需求吧
  • 在不升级中, 4我觉着最好, 找时间以后升级, 3其次, 6是说, 以后也不升级了, 这不好
  • 在升级中, 1最好, 2其次, 5最差
  • 总和起来, 从好到坏排: 4, 1, 3, 6, 2, 5, 如果是1-5分评分的话, 我会评4, 1, 3, 5, 1, 2

16. Customer Complaints on Recommendation Service

17. New Product Design

总共有8 weeks的时间, 安排工作任务.

Feature Engineer Estimate of Time to Develop Product Manager’s Prioritization of Benefit
A 1 to 2 weeks Medium
B 4 to 6 weeks High
C 2 to 4 weeks Low
D 2 to 4 weeks Medium
E 5 to 9 weeks High
F 3 to 5 weeks High
G 2 to 4 weeks Medium
H 1 to 2 weeks Low

Rate the effectiveness of each of the following options:

  1. F, G
  2. A, B, D
  3. A, C, D, G
  4. A, D, F
  5. A, C, F
  6. A, C, D, G, H

Answer:

这个题目是要做一个时间和优先级的权衡.

  1. 优先做优先级更高的feature
  2. 时间安排要合理

High: B, E, F

Medium: A, D, G

Low: C, H

Option Time Features Rank Comment
F, G 5-9 1 1 0 4 时间安排不够紧凑, 浪费时间
A, B, D 7-12 1 2 0 2 任务安排合理, 但是时间略紧
A, C, D, G 7-14 0 3 1 5 没有完成任何一个高优先级的工作
A, D, F 6-11 1 2 0 1 任务安排合理, 也能够在规定时间内完成
A, C, F 6-11 1 1 1 3 在有限的时间内应该尽可能完成高优先级的任务, 所以最好不要完成Low的任务
A, C, D, G, H 8-15 0 3 2 6 没有完成任何一个高优先级的工作, 时间太紧, 基本无法按时完成
  1. 先把 A, C, D, G 和 A, C, D, G, H 比较, 因为这两个里没有High的任务, 所以这两个最差, 但是 A, C, D, G 的时间要合理些.
  2. 再比较 F, G 和 A, C, F , 都是只完成了一个High, 一个Medium, 然后 A, C, F 多做了一个Low, 我是觉着 A, C, F 要好些, F, G 的时间太宽裕, A, C, F 至少比 F, G 多干了一个活
  3. 最后是 A, B, D 和 A, D, F 的比较, 完成的任务数量和优先级是一样的, 这里就要考虑时间了.A, D, F 的耗时是6-11, 总共有8 weeks, 比 A, B, D 的7-12合理

18-20. Last part of code

18 What is the problem with the Product.wasPurchasedByUser()?

  1. It will run slowly because algorithm complexity is O(n^2)
  2. It will run slowly on large datasets because more than one user could have purchased the same product.
  3. It will run slowly because algorithm complexity is O(n^3)
  4. It has performance issues.
class Product {
	public boolean wasPurchasedByUser(Shop shop, User user) {
		for(ShoppingCart shoppingCart : shop.getShoppingCarts()) { 
			for(Product product : shoppingCart.getProducts) {
				if(product.getId() == this.getId() && shoppingCart.getUser().getUserId() == user.getUserId()) {
					return true;
				}
			}
		}
	}
}
  • 这个方法的作用是判断一个商品有没有被一个特定的用户购买. 这个方法会遍历所有的shopping cart, 然后遍历shopping cart中所有的商品, 会很慢.
  • 选项2, 前半部分对, 后面because more than one user could have purchased the same product. 这个原因不对. 即使只有一个用户买了这个商品, 运行速度依然很慢
  • 选项4是正确的

19 What is the most effective way of improving the ShoppingCart() class for the long term?

  1. ShoppingCart should not override the user property every time new product is added to it.
  2. Make Shopping Cart a property of Product class to improve performace.
  3. Change the design of Shopping Cart by removing ShoppingCart.user and making shopping cart a property of User instead.
  4. Product should have getUser() method so that we know what user has added it to his/her shopping cart.

经过18题的分析, 可以比较容易的得出, shopping cart应该做为user的一个属性存在. 所以选3

20 5个测试用例, 看哪个会通过, 哪个会失败, 面经上的是对的

Test1 失败, getDefaultPaymentMethod() 返回 null

Test3 失败, 构造函数中没有初始化email

Test5 失败, setPrice()中的参数是Integer, 会把10.75强制转化成Integer

21. Problem with the website

Jacob发邮件来说线上网站遇到了问题, 他不知道为什么, 来寻求帮助. 然后要向Jacob提问, 给以下问题的重要性评分

  1. Do any other projects depend on fixing this problem?
  2. How long will it take to solve this problem?
  3. How does this affect customers?
  4. Are we receiving complaints from customers?
  5. How many customers is this affecting?
  6. If I help you with this problem, will you help me finish my work today?

我觉着跟用户相关的都可以评5分, 谁让Amazon用户至上呢; 然后1评4分吧, 这个也很重要; 2问要花多长时间, 我觉着Jacob都不知道是什么问题, 怎么来估计时间呢, 所以不太现实, 评3分吧; 然后6, 显得有点自私, 一定要评1分. 总结一下 435551

贴几个OA2的截图参考一下吧,顺序有点乱

1

2|624x368

3|624x361

4|624x361

5|383x665

6

7|624x367

8|367x665

9

10

11|624x357

12|624x363

2 Likes