Amazon Phone Interview SDE2
Anonymous User
2158

Behavioral

  1. Tell me about a time when you have worked against tight deadlines and didn't have the time to consider all options before deciding. How much time did you have? What approach did you take?

  2. Give me an example of a mission or goal you didn’t think was achievable. What was it and how did you help your team try to achieve it? Were you successful in the end?

Coding

Design a solution which can perform the following operations

  1. Given two IDs, associate those IDs as friends, and any existing friends of those IDs also become friends.
    (if 1 and 2 are friends, and 2 and 3 are friends, then 1 and 3 are also friends)

  2. Given two IDs, return true if they are friends.

Example:
(Input) -> Resulting Group(s) of Friends
makeFriends(1, 2) -> {1, 2}
areFriends(1,2) -> TRUE
areFriends(3,4) -> FALSE

makeFriends(3, 4) -> {1, 2} {3, 4}
areFriends(1,2) -> TRUE
areFriends(3,4) -> TRUE
areFriends(2,3) -> FALSE

makeFriends(2, 3) -> {1, 2, 3, 4}
areFriends(1,4) -> TRUE

Comments (7)