Position: SDE AWS IoT Analytics and Apps
Date: August 2019
Location: Seattle

Design a solution which can preform 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.
  3. Return the size of the largest group of friends.

Example:

1. (1, 2) -> {1, 2}
2. (3, 4) -> {1, 2} {3, 4}
3. (2, 3) -> {1, 2, 3, 4}
Comments (10)