亚麻onsite 面经总结

面经总结

算法数据结构

  1. Number of Islands(leetcode 200)

  2. Add and Search Word - Data structure design (leetcode 211)

  3. Word Search (leetcode 79,212)

  4. Find smallest range containing elements from k lists

  5. Reverse pairs

  6. Find all ancestors of LCA. 给出两个节点,打印出两个节点的所有公共祖先节点,算法也就是找出最近公共祖先(LCA),然后打印root到LCA的所有节点。

  7. Given a series of equations e.g. [A = B, B = D, C = D, F = G, E = H, H = C] and then another series [A != C, D != H, …, F != A ]. Check whether the equations combined is valid.
    For the example given, your program should return ‘invalid’, because the first series implies that A = C, which contradicts the statement A != C in the second series.
    Imagine you have a computer keyboard that has all the letters mismatched.
    example:
    typing q gives you a
    typing w gives you b
    all 26 letters in the alphabet are there, but typing one letter will give you another one you are asked to write an algorithm to find whatever word you tried to type and count how many cycles you did to find the word
    a restriction was set you need to type the whole word every time, not go character by character
    note: a graph was suggested to represent the letter mappings

  8. Given a sorted circularly linked list of Nodes that store integers and a new Node, insert the new Node into the correct position. (Duplicates allowed)

  9. How many times will a robot need to retrieve bins if it is given an array of bin ID’s and it can only hold N bins at a time? When the robot is already holding N bins, it will return the least recently retrieved bin and store the new bin.

  10. Given an array of unique integers, return a pair of integers that sum up to a target sum.

  11. Given an ArrayList of Nodes, with each Node having an ID and a parent ID, determine whether the List is given in preorder.

  12. Longest substring

系统设计

  1. 设计 商场里买了这件商品的人还买了什么,比如买了iPhone 推荐手机壳 ,耳机,贴膜…
    follow up 每天都会生成txt文件 里面包含100M+ 条信息,每条包括商品id,推荐的商品id列表,问怎么设计系统给用户推荐相关商品。要求做到,效率高,高可用.

  2. 用户使用网站的时候会连续访问多个页面,给出一个文件包含 用户id,page id,timestamp,要求访问最多次的连续三个页面组合.

  3. 已知city A坐标和周围n个cities的坐标,求前k个距离city A最远的cities.

Behavior question

  1. Why amazon?

  2. Do you get feedbacks from your friends or teammate? What is it? Positive or negative? What is the negative feedback you encountered? What did you learn from it? How did you feel when heard negative feedback?

  3. 举个例子你用客户的feedback来改进你project的例子。

  4. How would you decide which methods to use for a project when you doing a project?

  5. Describe a project that you think is most interesting or you feel very proud of? What did you learn from it?

  6. Understanding Amazon Principle “Are right, A lot”;