亚麻SDE3 AWS Group 纽约上门

Amazon takes the “Frugality” really serious:

  • Doesn’t offer decent perks (funny part of my interview, I asked the developer if he got Amazon prime for free, his answer was “hell no, you pay for everything” LOL)
  • For the interview, they put me on the cheapest hotel in NY (bed bugs and dirty bathroom)
  • The offices are depressing, and all the rooms are windowless and fluorescent lights. (feels like a basement)
  • The chairs are ridiculously unconfortable, good lucky working 9-10hours a day on that.
  • People seem to be always in a bad mood and not smiling. (too much stress?)
  • They offered me a bottle of water and a cereal bar for almost 6 hours of the interview on that day. (I didn’t touch that cereal bar)
  • Your bathroom break needs to be accompanied by the interviewer (that was awkward, to say the least).

I got the traditional Linkedin invitation, online assessment (the same questions mentioned in the other post), and eventually got called to be the on-site interview.

5 Rounds of the interview heavily focused on the 14 Leadership skills. Another half, straight out of LeetCode questions.

On the day of my interview, other 5 guys were interviewing as well, so the pile a bunch of candidates, I guess it was 5 in the morning and 5 in the afternoon for two days.

第一轮 (AWS Developer) :

    public int firstUniqChar(String s) {
       int[] map = new int[256];
        for(char c: s.toCharArray())
            map[c-'a']++;
        
        int i = 0;
        for(char c: s.toCharArray()){
            if(map[c-'a'] == 1) return i;
            i++;
        }
        return -1;
    }

第二轮 (AWS Senior developer)

  • Amazon leadership principals
  • Hard LeetCode question “Integer array representing building heights, you start on the first position, min steps to reach the end. Each position represents how many jumps you can perform.” https://leetcode.com/problems/jump-game-ii/
class Solution {
      int INVALID = Integer.MAX_VALUE;
      Map<Integer, Integer> cache = new HashMap<>();

      public int jump(int[] nums) {
        return countJumps(nums, 0);
      }

      public int countJumps(int[] nums, int i) {
        if (cache.containsKey(i))
          return cache.get(i);

        if (i >= nums.length - 1) {
          cache.put(i, 0);
          return 0;
        }

        if (i > 0 && nums[i] < nums[i - 1])
          return (cache.containsKey(i) ? cache.get(i) : INVALID);

        for (int k = 1; k <= nums[i] && i + k < nums.length; k++) {
          int temp = countJumps(nums, i + k);

          if (temp != INVALID && temp + 1 < (cache.containsKey(i) ? cache.get(i) : INVALID))
            cache.put(i, countJumps(nums, i + k) + 1);
        }
        return cache.containsKey(i) ? cache.get(i) : INVALID; //needs recheck the cache.
      }
}

第三轮 (with an AWS Architect)

  • Amazon leadership principals
  • Design a Loyalty Program system (good lucky trying to design something better than this guy that has a ton of experience on this specific, also in 10-15 minutes LOL)

第四轮 (AWS Commerce Manager)

  • Only Amazon leadership principals questions. (tell me about a time… )

第五轮 (AWS Manager)

  • Amazon leadership principals
  • Medium Code challenge: " Given a matrix with integers, each cell represents a ground elevation, after the rain lakes are formed. Find how many lakes were formed. A lake is an elevation where the four cardinal directional cells are higher. The borders are Negative INF." Similar to the number of islands problem in Leetcode: https://leetcode.com/problems/number-of-islands/
public class NumberOfLakes {

  int[][] coord = new int[][] {{0, 1 }, {0, -1 }, {1, 0 }, {-1, 0 } };
  int countLakes(int[][] m) {
    if (m == null || m.length == 0 || m[0].length == 0)
      return 0;
    int count = 0;
    boolean[][] visited = new boolean[m.length][m[0].length];

    for (int i = 1; i < m.length - 1; i++) {
      for (int j = 1; j < m[0].length - 1; j++) {
        if (visited[i][j]) continue;
        count += isLake(m, i, j, m[i][j], visited) ? 1 : 0;
      }
    }
    return count;
  }

  boolean isLake(int[][] m, int i, int j, int value, boolean visited[][]) {
    if (i <= 0 || j <= 0 || i >= m.length - 1 || j >= m[0].length - 1) return false;
    visited[i][j] = true;
    for (int[] c : coord) {
      int x = i + c[0];
      int y = j + c[1];
      if (x < 0 || y < 0 || x >= m.length || y >= m[0].length) continue;
      int v = m[x][y];
      if (v < value) return false;
      else if (visited[x][y]) continue;
      else if (v == value && !isLake(m, x, y, value, visited))  return false;
    }
    return true;
  }
}